browser_rules_shapes-toggle_02.js (1649B)
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 swatch to toggle a shapes highlighter does not show up 7 // on overwritten properties. 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 div { 17 clip-path: circle(30%); 18 } 19 </style> 20 <div id="shape"></div> 21 `; 22 23 add_task(async function () { 24 await addTab("data:text/html;charset=utf-8," + encodeURIComponent(TEST_URI)); 25 const { inspector, view } = await openRuleView(); 26 27 await selectNode("#shape", inspector); 28 const container = getRuleViewProperty(view, "#shape", "clip-path").valueSpan; 29 const shapeToggle = container.querySelector(".inspector-shapeswatch"); 30 const shapeToggleStyle = getComputedStyle(shapeToggle); 31 const overriddenContainer = getRuleViewProperty( 32 view, 33 "div", 34 "clip-path" 35 ).valueSpan; 36 const overriddenShapeToggle = overriddenContainer.querySelector( 37 ".inspector-shapeswatch" 38 ); 39 const overriddenShapeToggleStyle = getComputedStyle(overriddenShapeToggle); 40 41 ok( 42 shapeToggle && overriddenShapeToggle, 43 "Shapes highlighter toggles exist in the DOM." 44 ); 45 ok( 46 !shapeToggle.classList.contains("active") && 47 !overriddenShapeToggle.classList.contains("active"), 48 "Shapes highlighter toggle buttons are not active." 49 ); 50 51 isnot( 52 shapeToggleStyle.display, 53 "none", 54 "Shape highlighter toggle is not hidden" 55 ); 56 is( 57 overriddenShapeToggleStyle.display, 58 "none", 59 "Overwritten shape highlighter toggle is not visible" 60 ); 61 });