browser_rules_edit-property_10.js (1790B)
1 /* Any copyright is dedicated to the Public Domain. 2 http://creativecommons.org/publicdomain/zero/1.0/ */ 3 4 "use strict"; 5 6 const TEST_URI = ` 7 <style> 8 div { 9 color: red; 10 width: 10; /* This document is in quirks mode so this value should be valid */ 11 } 12 </style> 13 <div></div> 14 `; 15 16 // Test that CSS property names are case insensitive when validating, and that 17 // quirks mode is accounted for when validating. 18 add_task(async function () { 19 await addTab("data:text/html;charset=utf-8," + encodeURIComponent(TEST_URI)); 20 const { inspector, view: ruleView } = await openRuleView(); 21 22 await selectNode("div", inspector); 23 let prop = getTextProperty(ruleView, 1, { color: "red" }); 24 25 let onRuleViewChanged; 26 27 info(`Rename the CSS property name to "Color"`); 28 onRuleViewChanged = ruleView.once("ruleview-changed"); 29 await renameProperty(ruleView, prop, "Color"); 30 info("Wait for Rule view to update"); 31 await onRuleViewChanged; 32 33 is(prop.overridden, false, "Titlecase property is not overriden"); 34 is(prop.enabled, true, "Titlecase property is enabled"); 35 is(prop.isNameValid(), true, "Titlecase property is valid"); 36 37 info(`Rename the CSS property name to "COLOR"`); 38 onRuleViewChanged = ruleView.once("ruleview-changed"); 39 await renameProperty(ruleView, prop, "COLOR"); 40 info("Wait for Rule view to update"); 41 await onRuleViewChanged; 42 43 is(prop.overridden, false, "Uppercase property is not overriden"); 44 is(prop.enabled, true, "Uppercase property is enabled"); 45 is(prop.isNameValid(), true, "Uppercase property is valid"); 46 47 info(`Checking width validity`); 48 prop = getTextProperty(ruleView, 1, { width: "10" }); 49 is(prop.isNameValid(), true, "width is a valid property"); 50 is(prop.isValid(), true, "10 is a valid property value in quirks mode"); 51 });