browser_rules_flexbox-highlighter-on-navigate.js (1358B)
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 flexbox highlighter is hidden on page navigation. 7 8 const TEST_URI = ` 9 <style type='text/css'> 10 #flex { 11 display: flex; 12 } 13 </style> 14 <div id="flex"></div> 15 `; 16 17 const TEST_URI_2 = "data:text/html,<html><body>test</body></html>"; 18 19 add_task(async function () { 20 await addTab("data:text/html;charset=utf-8," + encodeURIComponent(TEST_URI)); 21 const { inspector, view } = await openRuleView(); 22 const HIGHLIGHTER_TYPE = inspector.highlighters.TYPES.FLEXBOX; 23 const { getNodeForActiveHighlighter, waitForHighlighterTypeShown } = 24 getHighlighterTestHelpers(inspector); 25 26 await selectNode("#flex", inspector); 27 const container = getRuleViewProperty(view, "#flex", "display").valueSpan; 28 const flexboxToggle = container.querySelector( 29 ".js-toggle-flexbox-highlighter" 30 ); 31 32 info("Toggling ON the flexbox highlighter from the rule-view."); 33 const onHighlighterShown = waitForHighlighterTypeShown(HIGHLIGHTER_TYPE); 34 flexboxToggle.click(); 35 await onHighlighterShown; 36 ok( 37 getNodeForActiveHighlighter(HIGHLIGHTER_TYPE), 38 "Flexbox highlighter is shown." 39 ); 40 41 await navigateTo(TEST_URI_2); 42 ok( 43 !getNodeForActiveHighlighter(HIGHLIGHTER_TYPE), 44 "Flexbox highlighter is hidden." 45 ); 46 });