Add sanity test for enabling important option
This commit is contained in:
parent
df507aba24
commit
269b244b8d
3 changed files with 28403 additions and 4 deletions
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 })
|
||||
|
|
|
|||
|
|
@ -10,7 +10,8 @@ function buildDistFile(filename) {
|
|||
fs.readFile(`./${filename}.css`, (err, css) => {
|
||||
if (err) throw err
|
||||
|
||||
return postcss([tailwind(), require('autoprefixer')])
|
||||
// return postcss([tailwind(), require('autoprefixer')])
|
||||
return postcss([tailwind()])
|
||||
.process(css, {
|
||||
from: `./${filename}.css`,
|
||||
to: `./dist/${filename}.css`,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue