mirror of
https://github.com/tailwindlabs/tailwindcss.git
synced 2025-12-08 21:36:08 +00:00
[0.3] Rename parent-hover to group-hover (#271)
This commit is contained in:
parent
ad48de9500
commit
858b725896
@ -72,9 +72,9 @@ test('setting modules to "all" creates all variants for all modules', () => {
|
||||
|
||||
expect(result).toEqual({
|
||||
modules: {
|
||||
flexbox: ['responsive', 'hover', 'focus', 'parent-hover'],
|
||||
textAlign: ['responsive', 'hover', 'focus', 'parent-hover'],
|
||||
textColors: ['responsive', 'hover', 'focus', 'parent-hover'],
|
||||
flexbox: ['responsive', 'hover', 'focus', 'group-hover'],
|
||||
textAlign: ['responsive', 'hover', 'focus', 'group-hover'],
|
||||
textColors: ['responsive', 'hover', 'focus', 'group-hover'],
|
||||
},
|
||||
options: {},
|
||||
})
|
||||
|
||||
@ -48,9 +48,9 @@ test('it can generate focus variants', () => {
|
||||
})
|
||||
})
|
||||
|
||||
test('it can generate parent-hover variants', () => {
|
||||
test('it can generate group-hover variants', () => {
|
||||
const input = `
|
||||
@variants parent-hover {
|
||||
@variants group-hover {
|
||||
.banana { color: yellow; }
|
||||
.chocolate { color: brown; }
|
||||
}
|
||||
@ -59,8 +59,8 @@ test('it can generate parent-hover variants', () => {
|
||||
const output = `
|
||||
.banana { color: yellow; }
|
||||
.chocolate { color: brown; }
|
||||
.parent:hover .parent-hover\\:banana { color: yellow; }
|
||||
.parent:hover .parent-hover\\:chocolate { color: brown; }
|
||||
.group:hover .group-hover\\:banana { color: yellow; }
|
||||
.group:hover .group-hover\\:chocolate { color: brown; }
|
||||
`
|
||||
|
||||
return run(input).then(result => {
|
||||
|
||||
@ -21,12 +21,12 @@ const variantGenerators = {
|
||||
|
||||
container.before(cloned.nodes)
|
||||
},
|
||||
'parent-hover': (container, config) => {
|
||||
'group-hover': (container, config) => {
|
||||
const cloned = container.clone()
|
||||
|
||||
cloned.walkRules(rule => {
|
||||
// prettier-ignore
|
||||
rule.selector = `.parent:hover ${buildClassVariant(rule.selector, 'parent-hover', config.options.separator)}`
|
||||
rule.selector = `.group:hover ${buildClassVariant(rule.selector, 'group-hover', config.options.separator)}`
|
||||
})
|
||||
|
||||
container.before(cloned.nodes)
|
||||
@ -48,7 +48,7 @@ export default function(config) {
|
||||
|
||||
atRule.before(atRule.clone().nodes)
|
||||
|
||||
_.forEach(['focus', 'hover', 'parent-hover'], variant => {
|
||||
_.forEach(['focus', 'hover', 'group-hover'], variant => {
|
||||
if (variants.includes(variant)) {
|
||||
variantGenerators[variant](atRule, unwrappedConfig)
|
||||
}
|
||||
|
||||
@ -2,7 +2,7 @@ import _ from 'lodash'
|
||||
|
||||
function mergeModules(userModules, defaultModules) {
|
||||
if (userModules === 'all') {
|
||||
return _.mapValues(defaultModules, () => ['responsive', 'hover', 'focus', 'parent-hover'])
|
||||
return _.mapValues(defaultModules, () => ['responsive', 'hover', 'focus', 'group-hover'])
|
||||
}
|
||||
|
||||
return _.defaults(userModules, defaultModules)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user