browser_rules_edit-property_03.js (1607B)
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 emptying out an existing value removes the property and 7 // doesn't cause any other issues. See also Bug 1150780. 8 9 const TEST_URI = ` 10 <style type="text/css"> 11 #testid { 12 color: red; 13 background-color: blue; 14 font-size: 12px; 15 } 16 .testclass, .unmatched { 17 background-color: green; 18 } 19 </style> 20 <div id="testid" class="testclass">Styled Node</div> 21 <div id="testid2">Styled Node</div> 22 `; 23 24 add_task(async function () { 25 await addTab("data:text/html;charset=utf-8," + encodeURIComponent(TEST_URI)); 26 const { inspector, view } = await openRuleView(); 27 await selectNode("#testid", inspector); 28 29 const ruleEditor = getRuleViewRuleEditor(view, 1); 30 const propEditor = getTextProperty(view, 1, { 31 "background-color": "blue", 32 }).editor; 33 34 await focusEditableField(view, propEditor.valueSpan); 35 36 info("Deleting all the text out of a value field"); 37 let onRuleViewChanged = view.once("ruleview-changed"); 38 await sendKeysAndWaitForFocus(view, ruleEditor.element, ["DELETE", "TAB"]); 39 await onRuleViewChanged; 40 41 info("Pressing enter a couple times to cycle through editors"); 42 await sendKeysAndWaitForFocus(view, ruleEditor.element, ["TAB"]); 43 onRuleViewChanged = view.once("ruleview-changed"); 44 await sendKeysAndWaitForFocus(view, ruleEditor.element, ["TAB"]); 45 await onRuleViewChanged; 46 47 isnot(propEditor.nameSpan.style.display, "none", "The name span is visible"); 48 is(ruleEditor.rule.textProps.length, 2, "Correct number of props"); 49 });