browser_rules_edit-selector_12.js (1228B)
1 /* Any copyright is dedicated to the Public Domain. 2 http://creativecommons.org/publicdomain/zero/1.0/ */ 3 4 "use strict"; 5 6 // Test editing selectors for rules inside @import'd stylesheets. 7 // This is a regression test for bug 1355819. 8 9 add_task(async function () { 10 await addTab(URL_ROOT + "doc_edit_imported_selector.html"); 11 const { inspector, view } = await openRuleView(); 12 13 info("Select the node styled by an @import'd rule"); 14 await selectNode("#target", inspector); 15 16 info("Focus the selector in the rule-view"); 17 let ruleEditor = getRuleViewRuleEditor(view, 1); 18 const editor = await focusEditableField(view, ruleEditor.selectorText); 19 20 info("Change the selector to something else"); 21 editor.input.value = "div"; 22 const onRuleViewChanged = once(view, "ruleview-changed"); 23 EventUtils.synthesizeKey("KEY_Enter"); 24 await onRuleViewChanged; 25 26 info("Check the rules are still displayed correctly"); 27 is(view._elementStyle.rules.length, 3, "The element still has 3 rules."); 28 29 ruleEditor = getRuleViewRuleEditor(view, 1); 30 is( 31 ruleEditor.element.getAttribute("unmatched"), 32 "false", 33 "Rule editor is matched." 34 ); 35 is(ruleEditor.selectorText.textContent, "div", "The new selector is correct"); 36 });