browser_rules_shapes-toggle_05.js (1506B)
1 /* Any copyright is dedicated to the Public Domain. 2 http://creativecommons.org/publicdomain/zero/1.0/ */ 3 4 "use strict"; 5 6 // Tests that the shapes highlighter is hidden when the highlighted shape container is 7 // removed from the page. 8 9 const TEST_URI = ` 10 <style type='text/css'> 11 #shape { 12 width: 800px; 13 height: 800px; 14 clip-path: circle(25%); 15 } 16 </style> 17 <div id="shape"></div> 18 `; 19 20 add_task(async function () { 21 await addTab("data:text/html;charset=utf-8," + encodeURIComponent(TEST_URI)); 22 const { inspector, view } = await openRuleView(); 23 const highlighters = view.highlighters; 24 25 info("Select a node with a shape value"); 26 await selectNode("#shape", inspector); 27 const container = getRuleViewProperty(view, "#shape", "clip-path").valueSpan; 28 const shapeToggle = container.querySelector(".inspector-shapeswatch"); 29 30 info("Toggling ON the CSS shapes highlighter from the rule-view."); 31 const onHighlighterShown = highlighters.once("shapes-highlighter-shown"); 32 shapeToggle.click(); 33 await onHighlighterShown; 34 ok(highlighters.shapesHighlighterShown, "CSS shapes highlighter is shown."); 35 36 const onHighlighterHidden = highlighters.once("shapes-highlighter-hidden"); 37 info("Remove the #shapes container in the content page"); 38 await SpecialPowers.spawn(gBrowser.selectedBrowser, [], () => 39 content.document.querySelector("#shape").remove() 40 ); 41 await onHighlighterHidden; 42 ok(!highlighters.shapesHighlighterShown, "CSS shapes highlighter is hidden."); 43 });