browser_styleeditor_syncAlreadyOpen.js (1323B)
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 { 17 /*! font-size: 4em; */ 18 } 19 `; 20 21 add_task(async function () { 22 await addTab(TESTCASE_URI); 23 24 const { inspector, view, toolbox } = await openRuleView(); 25 await selectNode("#testid", inspector); 26 27 // In this test, make sure the style editor is open before making 28 // changes in the inspector. 29 const { ui } = await openStyleEditor(); 30 const editor = await ui.editors[0].getSourceEditor(); 31 32 const onEditorChange = new Promise(resolve => { 33 editor.sourceEditor.on("change", resolve); 34 }); 35 36 await toolbox.selectTool("inspector"); 37 const ruleEditor = getRuleViewRuleEditor(view, 1); 38 39 // Disable the "font-size" property. 40 const propEditor = ruleEditor.rule.textProps[0].editor; 41 const onModification = view.once("ruleview-changed"); 42 propEditor.enable.click(); 43 await onModification; 44 45 await openStyleEditor(); 46 await onEditorChange; 47 48 const text = editor.sourceEditor.getText(); 49 is(text, expectedText, "style inspector changes are synced"); 50 });