Merge pull request #636 from tailwindcss/test-important

Add sanity test for `important` option
This commit is contained in:
Adam Wathan 2019-02-01 12:31:50 -05:00 committed by GitHub
commit 8b1b797b9f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 28401 additions and 3 deletions

File diff suppressed because it is too large Load Diff

View File

@ -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 })