browser_rules_edit-property_06.js (1735B)
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 editing a property's priority is behaving correctly, and disabling 7 // and editing the property will re-enable the property. 8 9 const TEST_URI = ` 10 <style type='text/css'> 11 body { 12 background-color: green !important; 13 } 14 body { 15 background-color: red; 16 } 17 </style> 18 `; 19 20 add_task(async function () { 21 await addTab("data:text/html;charset=utf-8," + encodeURIComponent(TEST_URI)); 22 const { inspector, view } = await openRuleView(); 23 await selectNode("body", inspector); 24 25 const prop = getTextProperty(view, 1, { "background-color": "red" }); 26 27 is( 28 await getComputedStyleProperty("body", null, "background-color"), 29 "rgb(0, 128, 0)", 30 "green background color is set." 31 ); 32 33 await setProperty(view, prop, "red !important"); 34 35 is( 36 prop.editor.valueSpan.textContent, 37 "red !important", 38 "'red !important' property value is correctly set." 39 ); 40 is( 41 await getComputedStyleProperty("body", null, "background-color"), 42 "rgb(255, 0, 0)", 43 "red background color is set." 44 ); 45 46 info("Disabling red background color property"); 47 await togglePropStatus(view, prop); 48 49 is( 50 await getComputedStyleProperty("body", null, "background-color"), 51 "rgb(0, 128, 0)", 52 "green background color is set." 53 ); 54 55 await setProperty(view, prop, "red"); 56 57 is( 58 prop.editor.valueSpan.textContent, 59 "red", 60 "'red' property value is correctly set." 61 ); 62 ok(prop.enabled, "red background-color property is enabled."); 63 is( 64 await getComputedStyleProperty("body", null, "background-color"), 65 "rgb(0, 128, 0)", 66 "green background color is set." 67 ); 68 });