diff --git a/spec/style-manager-spec.js b/spec/style-manager-spec.js index 898e85587..120eb1394 100644 --- a/spec/style-manager-spec.js +++ b/spec/style-manager-spec.js @@ -1,10 +1,11 @@ +const temp = require('temp') const StyleManager = require('../src/style-manager') describe('StyleManager', () => { let [styleManager, addEvents, removeEvents, updateEvents] = [] beforeEach(() => { - styleManager = new StyleManager({configDirPath: atom.getConfigDirPath()}) + styleManager = new StyleManager({configDirPath: temp.mkdirSync('atom-config')}) addEvents = [] removeEvents = [] updateEvents = [] @@ -43,12 +44,12 @@ describe('StyleManager', () => { atom-text-editor[mini].is-focused::shadow .class-7 { color: green; } `) expect(Array.from(styleManager.getStyleElements()[0].sheet.cssRules).map((r) => r.selectorText)).toEqual([ - 'atom-text-editor .class-1, atom-text-editor .class-2', - 'atom-text-editor > .class-3', + 'atom-text-editor.editor .class-1, atom-text-editor.editor .class-2', + 'atom-text-editor.editor > .class-3', 'atom-text-editor .class-4', 'another-element::shadow .class-5', - 'atom-text-editor[data-grammar*=\"js\"] .class-6', - 'atom-text-editor[mini].is-focused .class-7' + 'atom-text-editor[data-grammar*=\"js\"].editor .class-6', + 'atom-text-editor[mini].is-focused.editor .class-7' ]) }) @@ -75,8 +76,8 @@ describe('StyleManager', () => { `) expect(Array.from(styleManager.getStyleElements()[1].sheet.cssRules).map((r) => r.selectorText)).toEqual([ '.source > .js, .source.coffee', - 'atom-text-editor .syntax--source > .syntax--js', - 'atom-text-editor[mini].is-focused .syntax--source > .syntax--js', + 'atom-text-editor.editor .syntax--source > .syntax--js', + 'atom-text-editor[mini].is-focused.editor .syntax--source > .syntax--js', 'atom-text-editor .source > .js' ]) }) diff --git a/src/style-manager.js b/src/style-manager.js index b273f449b..7ee11fd6d 100644 --- a/src/style-manager.js +++ b/src/style-manager.js @@ -270,7 +270,8 @@ function transformDeprecatedShadowDOMSelectors (css, context) { } } else { if (previousNodeIsAtomTextEditor && node.type === 'pseudo' && node.value === '::shadow') { - selector.removeChild(node) + node.type = 'className' + node.value = '.editor' targetsAtomTextEditorShadow = true } }