mirror of
https://github.com/tailwindlabs/tailwindcss.git
synced 2025-12-08 21:36:08 +00:00
Update tests
This commit is contained in:
parent
b2b95d5738
commit
f80537a85d
@ -1,14 +1,14 @@
|
||||
import postcss from 'postcss'
|
||||
import plugin from '../src/lib/substituteClassApplyAtRules'
|
||||
|
||||
function run(input, opts) {
|
||||
function run(input, opts = () => {}) {
|
||||
return postcss([plugin(opts)]).process(input)
|
||||
}
|
||||
|
||||
test("it copies a class's declarations into itself", () => {
|
||||
const output = '.a { color: red; } .b { color: red; }'
|
||||
|
||||
return run('.a { color: red; } .b { @apply .a; }', {}).then(result => {
|
||||
return run('.a { color: red; } .b { @apply .a; }').then(result => {
|
||||
expect(result.css).toEqual(output)
|
||||
expect(result.warnings().length).toBe(0)
|
||||
})
|
||||
@ -38,16 +38,15 @@ test("it doesn't copy a media query definition into itself", () => {
|
||||
|
||||
.b {
|
||||
@apply .a;
|
||||
}`,
|
||||
{}
|
||||
).then(result => {
|
||||
}`)
|
||||
.then(result => {
|
||||
expect(result.css).toEqual(output)
|
||||
expect(result.warnings().length).toBe(0)
|
||||
})
|
||||
})
|
||||
|
||||
test('it fails if the class does not exist', () => {
|
||||
run('.b { @apply .a; }', {}).catch(error => {
|
||||
run('.b { @apply .a; }').catch(error => {
|
||||
expect(error.reason).toEqual('No .a class found.')
|
||||
})
|
||||
})
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
import postcss from 'postcss'
|
||||
import plugin from '../src/lib/substituteFocusableAtRules'
|
||||
|
||||
function run(input, opts = {}) {
|
||||
function run(input, opts = () => {}) {
|
||||
return postcss([plugin(opts)]).process(input)
|
||||
}
|
||||
|
||||
@ -18,7 +18,7 @@ test("it adds a focusable variant to each nested class definition", () => {
|
||||
.chocolate, .focus\\:chocolate:focus { color: brown; }
|
||||
`
|
||||
|
||||
return run(input, {}).then(result => {
|
||||
return run(input).then(result => {
|
||||
expect(result.css).toEqual(output)
|
||||
expect(result.warnings().length).toBe(0)
|
||||
})
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
import postcss from 'postcss'
|
||||
import plugin from '../src/lib/substituteHoverableAtRules'
|
||||
|
||||
function run(input, opts = {}) {
|
||||
function run(input, opts = () => {}) {
|
||||
return postcss([plugin(opts)]).process(input)
|
||||
}
|
||||
|
||||
@ -18,7 +18,7 @@ test("it adds a hoverable variant to each nested class definition", () => {
|
||||
.chocolate, .hover\\:chocolate:hover { color: brown; }
|
||||
`
|
||||
|
||||
return run(input, {}).then(result => {
|
||||
return run(input).then(result => {
|
||||
expect(result.css).toEqual(output)
|
||||
expect(result.warnings().length).toBe(0)
|
||||
})
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user