browser_rules_variables-in-pseudo-element_01.js (928B)
1 /* Any copyright is dedicated to the Public Domain. 2 http://creativecommons.org/publicdomain/zero/1.0/ */ 3 4 "use strict"; 5 6 // Test for pseudo element which defines CSS variable. 7 8 const TEST_URI = ` 9 <style type='text/css'> 10 div::before { 11 color: var(--color); 12 --color: orange; 13 } 14 15 div { 16 color: var(--color); 17 --color: lime; 18 } 19 </style> 20 <div></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 await selectNode("div", inspector); 27 28 info("Test the CSS variable which normal element is referring to"); 29 checkCSSVariableOutput(view, "div", "color", "inspector-variable", "lime"); 30 31 info("Test the CSS variable which pseudo element is referring to"); 32 checkCSSVariableOutput( 33 view, 34 "div::before", 35 "color", 36 "inspector-variable", 37 "orange" 38 ); 39 });