From e1d276468b00b9dd10054830b5b5ca95ccf6b73d Mon Sep 17 00:00:00 2001 From: Adam Wathan Date: Mon, 14 Jan 2019 13:28:18 -0500 Subject: [PATCH] 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. --- src/util/buildSelectorVariant.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/util/buildSelectorVariant.js b/src/util/buildSelectorVariant.js index 5fbb0e9d0..dfa0bc9d6 100644 --- a/src/util/buildSelectorVariant.js +++ b/src/util/buildSelectorVariant.js @@ -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) }