browser_rules_edit-variable-remove.js (906B)
1 /* Any copyright is dedicated to the Public Domain. 2 http://creativecommons.org/publicdomain/zero/1.0/ */ 3 4 "use strict"; 5 6 // Test removing a CSS variable. 7 8 const TEST_URI = ` 9 <style type='text/css'> 10 div { 11 color: var(--color); 12 --color: lime; 13 } 14 </style> 15 <div></div> 16 `; 17 18 add_task(async function () { 19 await addTab("data:text/html;charset=utf-8," + encodeURIComponent(TEST_URI)); 20 const { inspector, view } = await openRuleView(); 21 await selectNode("div", inspector); 22 23 info("Check the initial state of the --color variable"); 24 checkCSSVariableOutput(view, "div", "color", "inspector-variable", "lime"); 25 26 info("Remove the --color variable declaration"); 27 const prop = getTextProperty(view, 1, { "--color": "lime" }); 28 await removeProperty(view, prop); 29 checkCSSVariableOutput( 30 view, 31 "div", 32 "color", 33 "inspector-unmatched", 34 "--color is not set" 35 ); 36 });