browser_styleeditor_syncEditSelector.js (1034B)
1 /* Any copyright is dedicated to the Public Domain. 2 http://creativecommons.org/publicdomain/zero/1.0/ */ 3 "use strict"; 4 5 // Test that changes in the style inspector are synchronized into the 6 // style editor. 7 8 const TESTCASE_URI = TEST_BASE_HTTP + "sync.html"; 9 10 const expectedText = ` 11 body { 12 border-width: 15px; 13 color: red; 14 } 15 16 #testid, span { 17 font-size: 4em; 18 } 19 `; 20 21 add_task(async function () { 22 await addTab(TESTCASE_URI); 23 const { inspector, view } = await openRuleView(); 24 await selectNode("#testid", inspector); 25 const ruleEditor = getRuleViewRuleEditor(view, 1); 26 27 let editor = await focusEditableField(view, ruleEditor.selectorText); 28 editor.input.value = "#testid, span"; 29 const onRuleViewChanged = once(view, "ruleview-changed"); 30 EventUtils.synthesizeKey("KEY_Enter"); 31 await onRuleViewChanged; 32 33 const { ui } = await openStyleEditor(); 34 35 editor = await ui.editors[0].getSourceEditor(); 36 const text = editor.sourceEditor.getText(); 37 is(text, expectedText, "selector edits are synced"); 38 });