Add test coverage for purging with important string
This commit is contained in:
parent
52f1a2d136
commit
2903811767
2 changed files with 22 additions and 1 deletions
|
|
@ -3,7 +3,7 @@
|
|||
<head>
|
||||
<title>My Page</title>
|
||||
</head>
|
||||
<body>
|
||||
<body id="tailwind">
|
||||
<main>
|
||||
<div class="bg-red-500 md:bg-blue-300 w-1/2"></div>
|
||||
</main>
|
||||
|
|
|
|||
|
|
@ -80,6 +80,27 @@ test('purges unused classes', () => {
|
|||
})
|
||||
})
|
||||
|
||||
test('purges unused classes with important string', () => {
|
||||
const OLD_NODE_ENV = process.env.NODE_ENV
|
||||
process.env.NODE_ENV = 'production'
|
||||
const inputPath = path.resolve(`${__dirname}/fixtures/tailwind-input.css`)
|
||||
const input = fs.readFileSync(inputPath, 'utf8')
|
||||
|
||||
return postcss([
|
||||
tailwind({
|
||||
...config,
|
||||
important: '#tailwind',
|
||||
purge: [path.resolve(`${__dirname}/fixtures/**/*.html`)],
|
||||
}),
|
||||
])
|
||||
.process(input, { from: inputPath })
|
||||
.then(result => {
|
||||
process.env.NODE_ENV = OLD_NODE_ENV
|
||||
|
||||
assertPurged(result)
|
||||
})
|
||||
})
|
||||
|
||||
test('does not purge components', () => {
|
||||
const OLD_NODE_ENV = process.env.NODE_ENV
|
||||
process.env.NODE_ENV = 'production'
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue