Skip to content

Commit 1a964bf

Browse files
committed
Get tests passing with updated dependencies
Latest postcss-selector-parser tries to be more intelligent about handling escape sequences for you. This is awesome! But our original code was handling escaping ourselves, so this change gets the tests passing for now, with the intent to stop doing escaping ourselves in the near future and instead rely on postcss-selector-parser to handle it for us, since I'm positive their implementation is significantly more robust.
1 parent 5f23429 commit 1a964bf

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/util/buildSelectorVariant.js

+7-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import escapeClassName from './escapeClassName'
22
import parser from 'postcss-selector-parser'
33
import tap from 'lodash/tap'
4+
import get from 'lodash/get'
45

56
export default function buildSelectorVariant(selector, variantName, separator, onError = () => {}) {
67
return parser(selectors => {
@@ -10,7 +11,12 @@ export default function buildSelectorVariant(selector, variantName, separator, o
1011
return
1112
}
1213

13-
classSelector.value = `${variantName}${escapeClassName(separator)}${classSelector.value}`
14+
const baseClass = get(classSelector, 'raws.value', classSelector.value)
15+
16+
classSelector.setPropertyAndEscape(
17+
'value',
18+
`${variantName}${escapeClassName(separator)}${baseClass}`
19+
)
1420
})
1521
}).processSync(selector)
1622
}

0 commit comments

Comments
 (0)