Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Rename parent-hover to group-hover
  • Loading branch information
adamwathan committed Nov 30, 2017
commit 4479cc4a8564a460979ffae5a85ba63aff9b2360
6 changes: 3 additions & 3 deletions __tests__/mergeConfigWithDefaults.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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: {},
})
Expand Down
8 changes: 4 additions & 4 deletions __tests__/variantsAtRule.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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; }
}
Expand All @@ -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 => {
Expand Down
6 changes: 3 additions & 3 deletions src/lib/substituteVariantsAtRules.js
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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)
}
Expand Down
2 changes: 1 addition & 1 deletion src/util/mergeConfigWithDefaults.js
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down