browser_rules_edit-property-remove_04.js (1347B)
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 removing the only declaration from a rule and unselecting then re-selecting 7 // the element will not restore the removed declaration. Bug 1512956 8 9 const TEST_URI = ` 10 <style type='text/css'> 11 #testid { 12 color: #00F; 13 } 14 </style> 15 <div id='testid'>Styled Node</div> 16 <div id='empty'></div> 17 `; 18 19 add_task(async function () { 20 await addTab("data:text/html;charset=utf-8," + encodeURIComponent(TEST_URI)); 21 const { inspector, view } = await openRuleView(); 22 23 info("Select original node"); 24 await selectNode("#testid", inspector); 25 26 info("Get the first property in the #testid rule"); 27 const rule = getRuleViewRuleEditor(view, 1).rule; 28 const prop = rule.textProps[0]; 29 30 info("Delete the property name to remove the declaration"); 31 const onRuleViewChanged = view.once("ruleview-changed"); 32 await removeProperty(view, prop, false); 33 info("Wait for Rule view to update"); 34 await onRuleViewChanged; 35 36 is(rule.textProps.length, 0, "No CSS properties left on the rule"); 37 38 info("Select another node"); 39 await selectNode("#empty", inspector); 40 41 info("Select original node again"); 42 await selectNode("#testid", inspector); 43 44 is(rule.textProps.length, 0, "Still no CSS properties on the rule"); 45 });