browser_rules_refresh-no-flicker.js (1367B)
1 /* Any copyright is dedicated to the Public Domain. 2 http://creativecommons.org/publicdomain/zero/1.0/ */ 3 4 "use strict"; 5 6 // Test that the rule view does not go blank while selecting a new node. 7 8 const TESTCASE_URI = 9 "data:text/html;charset=utf-8," + 10 '<div id="testdiv" style="font-size:10px;">' + 11 "Test div!</div>"; 12 13 add_task(async function () { 14 await addTab(TESTCASE_URI); 15 16 info("Opening the rule view and selecting the test node"); 17 const { inspector, view } = await openRuleView(); 18 const testdiv = await getNodeFront("#testdiv", inspector); 19 await selectNode(testdiv, inspector); 20 21 const htmlBefore = view.element.innerHTML; 22 Assert.greater( 23 htmlBefore.indexOf("font-size"), 24 -1, 25 "The rule view should contain a font-size property." 26 ); 27 28 // Do the selectNode call manually, because otherwise it's hard to guarantee 29 // that we can make the below checks at a reasonable time. 30 info("refreshing the node"); 31 const p = view.selectElement(testdiv, true); 32 is( 33 view.element.innerHTML, 34 htmlBefore, 35 "The rule view is unchanged during selection." 36 ); 37 ok( 38 view.element.classList.contains("non-interactive"), 39 "The rule view is marked non-interactive." 40 ); 41 await p; 42 43 info("node refreshed"); 44 ok( 45 !view.element.classList.contains("non-interactive"), 46 "The rule view is marked interactive again." 47 ); 48 });