browser_rules_shapes-toggle_04.js (1624B)
1 /* Any copyright is dedicated to the Public Domain. 2 http://creativecommons.org/publicdomain/zero/1.0/ */ 3 4 "use strict"; 5 6 // Test toggling the shapes highlighter in the rule view and modifying the 'clip-path' 7 // declaration. 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 let shapeToggle = container.querySelector(".inspector-shapeswatch"); 29 30 info("Toggling ON the CSS shape highlighter from the rule-view."); 31 const onHighlighterShown = highlighters.once("shapes-highlighter-shown"); 32 shapeToggle.click(); 33 await onHighlighterShown; 34 35 info("Edit the clip-path property to ellipse."); 36 const editor = await focusEditableField(view, container, 30); 37 const onDone = view.once("ruleview-changed"); 38 editor.input.value = "ellipse(30% 20%);"; 39 EventUtils.synthesizeKey("VK_RETURN", {}, view.styleWindow); 40 await onDone; 41 42 info( 43 "Check the shape highlighter and shape toggle button are still visible." 44 ); 45 shapeToggle = container.querySelector(".inspector-shapeswatch"); 46 ok(shapeToggle, "Shape highlighter toggle is visible."); 47 ok(highlighters.shapesHighlighterShown, "CSS shape highlighter is shown."); 48 });