browser_styleeditor_syncAddRule.js (864B)
1 /* Any copyright is dedicated to the Public Domain. 2 http://creativecommons.org/publicdomain/zero/1.0/ */ 3 "use strict"; 4 5 // Test that adding a new rule is synced to the style editor. 6 7 const TESTCASE_URI = TEST_BASE_HTTP + "sync.html"; 8 9 const expectedText = ` 10 #testid { 11 }`; 12 13 add_task(async function () { 14 await addTab(TESTCASE_URI); 15 const { inspector, view } = await openRuleView(); 16 await selectNode("#testid", inspector); 17 18 const onNewRuleAdded = once(view, "new-rule-added"); 19 view.addRuleButton.click(); 20 await onNewRuleAdded; 21 22 const { ui } = await openStyleEditor(); 23 24 await waitUntil(() => ui.editors.length > 1); 25 26 info("Selecting the second editor"); 27 await ui.selectStyleSheet(ui.editors[1].styleSheet); 28 29 const editor = ui.editors[1]; 30 const text = editor.sourceEditor.getText(); 31 is(text, expectedText, "selector edits are synced"); 32 });