-
Notifications
You must be signed in to change notification settings - Fork 4.5k
/
Copy pathmulti-root.test.ts
50 lines (47 loc) · 1.35 KB
/
multi-root.test.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
import { candidate, css, html, js, json, test } from '../utils'
test(
'production build',
{
fs: {
'package.json': json`
{
"dependencies": {
"postcss": "^8",
"postcss-cli": "^10",
"tailwindcss": "workspace:^",
"@tailwindcss/postcss": "workspace:^"
}
}
`,
'postcss.config.js': js`
module.exports = {
plugins: {
'@tailwindcss/postcss': {},
},
}
`,
'index.html': html`
<div class="one:underline two:underline"></div>
`,
'src/shared.css': css`
@reference 'tailwindcss/theme';
@import 'tailwindcss/utilities';
`,
'src/root1.css': css`
@import './shared.css';
@custom-variant one (&:is([data-root='1']));
`,
'src/root2.css': css`
@import './shared.css';
@custom-variant two (&:is([data-root='2']));
`,
},
},
async ({ fs, exec }) => {
await exec('pnpm postcss src/*.css -d dist')
await fs.expectFileToContain('dist/root1.css', [candidate`one:underline`])
await fs.expectFileNotToContain('dist/root1.css', [candidate`two:underline`])
await fs.expectFileNotToContain('dist/root2.css', [candidate`one:underline`])
await fs.expectFileToContain('dist/root2.css', [candidate`two:underline`])
},
)