|
| 1 | +import { candidate, css, html, json, test } from '../utils' |
| 2 | + |
| 3 | +test( |
| 4 | + 'builds the typography plugin utilities', |
| 5 | + { |
| 6 | + fs: { |
| 7 | + 'package.json': json` |
| 8 | + { |
| 9 | + "dependencies": { |
| 10 | + "@tailwindcss/typography": "^0.5.14", |
| 11 | + "tailwindcss": "workspace:^", |
| 12 | + "@tailwindcss/cli": "workspace:^" |
| 13 | + } |
| 14 | + } |
| 15 | + `, |
| 16 | + 'index.html': html` |
| 17 | + <div className="prose"> |
| 18 | + <h1>Headline</h1> |
| 19 | + <p> |
| 20 | + Until now, trying to style an article, document, or blog post with Tailwind has been a |
| 21 | + tedious task that required a keen eye for typography and a lot of complex custom CSS. |
| 22 | + </p> |
| 23 | + </div> |
| 24 | + `, |
| 25 | + 'src/index.css': css` |
| 26 | + @import 'tailwindcss'; |
| 27 | + @plugin '@tailwindcss/typography'; |
| 28 | + `, |
| 29 | + }, |
| 30 | + }, |
| 31 | + async ({ fs, exec }) => { |
| 32 | + await exec('pnpm tailwindcss --input src/index.css --output dist/out.css') |
| 33 | + |
| 34 | + await fs.expectFileToContain('dist/out.css', [ |
| 35 | + candidate`prose`, |
| 36 | + ':where(h1):not(:where([class~="not-prose"],[class~="not-prose"] *))', |
| 37 | + ':where(tbody td, tfoot td):not(:where([class~="not-prose"],[class~="not-prose"] *))', |
| 38 | + ]) |
| 39 | + }, |
| 40 | +) |
| 41 | + |
| 42 | +test( |
| 43 | + 'builds the forms plugin utilities', |
| 44 | + { |
| 45 | + fs: { |
| 46 | + 'package.json': json` |
| 47 | + { |
| 48 | + "dependencies": { |
| 49 | + "@tailwindcss/forms": "^0.5.7", |
| 50 | + "tailwindcss": "workspace:^", |
| 51 | + "@tailwindcss/cli": "workspace:^" |
| 52 | + } |
| 53 | + } |
| 54 | + `, |
| 55 | + 'index.html': html` |
| 56 | + <input type="text" class="form-input" /> |
| 57 | + <textarea class="form-textarea"></textarea> |
| 58 | + `, |
| 59 | + 'src/index.css': css` |
| 60 | + @import 'tailwindcss'; |
| 61 | + @plugin '@tailwindcss/forms'; |
| 62 | + `, |
| 63 | + }, |
| 64 | + }, |
| 65 | + async ({ fs, exec }) => { |
| 66 | + await exec('pnpm tailwindcss --input src/index.css --output dist/out.css') |
| 67 | + |
| 68 | + await fs.expectFileToContain('dist/out.css', [ |
| 69 | + // |
| 70 | + candidate`form-input`, |
| 71 | + candidate`form-textarea`, |
| 72 | + ]) |
| 73 | + await fs.expectFileNotToContain('dist/out.css', [ |
| 74 | + // |
| 75 | + candidate`form-radio`, |
| 76 | + ]) |
| 77 | + }, |
| 78 | +) |
0 commit comments