mirror of
https://github.com/tailwindlabs/tailwindcss.git
synced 2025-12-08 21:36:08 +00:00
Merge branch 'browner12-empty-variant'
This commit is contained in:
commit
b6286c9660
@ -133,6 +133,7 @@ const defaultVariantGenerators = (config) => ({
|
||||
last: generatePseudoClassVariant('last-child', 'last'),
|
||||
odd: generatePseudoClassVariant('nth-child(odd)', 'odd'),
|
||||
even: generatePseudoClassVariant('nth-child(even)', 'even'),
|
||||
empty: generatePseudoClassVariant('empty'),
|
||||
})
|
||||
|
||||
function prependStackableVariants(atRule, variants, stackableVariants) {
|
||||
|
||||
@ -806,6 +806,7 @@ module.exports = {
|
||||
'even',
|
||||
'visited',
|
||||
'checked',
|
||||
'empty',
|
||||
'group-hover',
|
||||
'group-focus',
|
||||
'focus-within',
|
||||
|
||||
@ -431,6 +431,27 @@ test('it can generate even variants', () => {
|
||||
})
|
||||
})
|
||||
|
||||
test('it can generate empty variants', () => {
|
||||
const input = `
|
||||
@variants empty {
|
||||
.banana { color: yellow; }
|
||||
.chocolate { color: brown; }
|
||||
}
|
||||
`
|
||||
|
||||
const output = `
|
||||
.banana { color: yellow; }
|
||||
.chocolate { color: brown; }
|
||||
.empty\\:banana:empty { color: yellow; }
|
||||
.empty\\:chocolate:empty { color: brown; }
|
||||
`
|
||||
|
||||
return run(input).then((result) => {
|
||||
expect(result.css).toMatchCss(output)
|
||||
expect(result.warnings().length).toBe(0)
|
||||
})
|
||||
})
|
||||
|
||||
test('it can generate group-hover variants', () => {
|
||||
const input = `
|
||||
@variants group-hover {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user