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.
This commit is contained in:
parent
49cbe268e5
commit
e1d276468b
1 changed files with 7 additions and 1 deletions
|
|
@ -1,6 +1,7 @@
|
|||
import escapeClassName from './escapeClassName'
|
||||
import parser from 'postcss-selector-parser'
|
||||
import tap from 'lodash/tap'
|
||||
import get from 'lodash/get'
|
||||
|
||||
export default function buildSelectorVariant(selector, variantName, separator, onError = () => {}) {
|
||||
return parser(selectors => {
|
||||
|
|
@ -10,7 +11,12 @@ export default function buildSelectorVariant(selector, variantName, separator, o
|
|||
return
|
||||
}
|
||||
|
||||
classSelector.value = `${variantName}${escapeClassName(separator)}${classSelector.value}`
|
||||
const baseClass = get(classSelector, 'raws.value', classSelector.value)
|
||||
|
||||
classSelector.setPropertyAndEscape(
|
||||
'value',
|
||||
`${variantName}${escapeClassName(separator)}${baseClass}`
|
||||
)
|
||||
})
|
||||
}).processSync(selector)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue