mirror of
https://github.com/tailwindlabs/tailwindcss.git
synced 2026-02-01 17:26:34 +00:00
Merge pull request #636 from tailwindcss/test-important
Add sanity test for `important` option
This commit is contained in:
commit
8b1b797b9f
28384
__tests__/fixtures/tailwind-output-important.css
Normal file
28384
__tests__/fixtures/tailwind-output-important.css
Normal file
File diff suppressed because it is too large
Load Diff
@ -2,10 +2,8 @@ import fs from 'fs'
|
||||
import path from 'path'
|
||||
import postcss from 'postcss'
|
||||
import tailwind from '../src/index'
|
||||
import config from '../defaultConfig.js'
|
||||
|
||||
/**
|
||||
* Tests
|
||||
*/
|
||||
it('generates the right CSS', () => {
|
||||
const inputPath = path.resolve(`${__dirname}/fixtures/tailwind-input.css`)
|
||||
const input = fs.readFileSync(inputPath, 'utf8')
|
||||
@ -22,6 +20,22 @@ it('generates the right CSS', () => {
|
||||
})
|
||||
})
|
||||
|
||||
it('generates the right CSS when "important" is enabled', () => {
|
||||
const inputPath = path.resolve(`${__dirname}/fixtures/tailwind-input.css`)
|
||||
const input = fs.readFileSync(inputPath, 'utf8')
|
||||
|
||||
return postcss([tailwind({ ...config, options: { ...config.options, important: true } })])
|
||||
.process(input, { from: inputPath })
|
||||
.then(result => {
|
||||
const expected = fs.readFileSync(
|
||||
path.resolve(`${__dirname}/fixtures/tailwind-output-important.css`),
|
||||
'utf8'
|
||||
)
|
||||
|
||||
expect(result.css).toBe(expected)
|
||||
})
|
||||
})
|
||||
|
||||
it('does not add any CSS if no Tailwind features are used', () => {
|
||||
return postcss([tailwind()])
|
||||
.process('.foo { color: blue; }', { from: undefined })
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user