browser_rules_multiple-properties-duplicates.js (2980B)
1 /* Any copyright is dedicated to the Public Domain. 2 http://creativecommons.org/publicdomain/zero/1.0/ */ 3 4 "use strict"; 5 6 // Test that the rule-view behaves correctly when entering mutliple and/or 7 // unfinished properties/values in inplace-editors 8 9 const TEST_URI = "<div>Test Element</div>"; 10 11 add_task(async function () { 12 await addTab("data:text/html;charset=utf-8," + encodeURIComponent(TEST_URI)); 13 const { inspector, view } = await openRuleView(); 14 await selectNode("div", inspector); 15 16 const ruleEditor = getRuleViewRuleEditor(view, 0); 17 // Note that we wait for a markup mutation here because this new rule will end 18 // up creating a style attribute on the node shown in the markup-view. 19 // (we also wait for the rule-view to refresh). 20 const onMutation = inspector.once("markupmutation"); 21 const onRuleViewChanged = view.once("ruleview-changed"); 22 await createNewRuleViewProperty( 23 ruleEditor, 24 "color:red;color:orange;color:yellow;color:green;color:blue;color:indigo;" + 25 "color:violet;" 26 ); 27 await onMutation; 28 await onRuleViewChanged; 29 30 is( 31 ruleEditor.rule.textProps.length, 32 7, 33 "Should have created new text properties." 34 ); 35 is( 36 ruleEditor.propertyList.children.length, 37 8, 38 "Should have created new property editors." 39 ); 40 41 is( 42 getTextProperty(view, 0, { color: "red" }).name, 43 "color", 44 "Should have correct property name" 45 ); 46 is( 47 getTextProperty(view, 0, { color: "red" }).value, 48 "red", 49 "Should have correct property value" 50 ); 51 52 is( 53 getTextProperty(view, 0, { color: "orange" }).name, 54 "color", 55 "Should have correct property name" 56 ); 57 is( 58 getTextProperty(view, 0, { color: "orange" }).value, 59 "orange", 60 "Should have correct property value" 61 ); 62 63 is( 64 getTextProperty(view, 0, { color: "yellow" }).name, 65 "color", 66 "Should have correct property name" 67 ); 68 is( 69 getTextProperty(view, 0, { color: "yellow" }).value, 70 "yellow", 71 "Should have correct property value" 72 ); 73 74 is( 75 getTextProperty(view, 0, { color: "green" }).name, 76 "color", 77 "Should have correct property name" 78 ); 79 is( 80 getTextProperty(view, 0, { color: "green" }).value, 81 "green", 82 "Should have correct property value" 83 ); 84 85 is( 86 getTextProperty(view, 0, { color: "blue" }).name, 87 "color", 88 "Should have correct property name" 89 ); 90 is( 91 getTextProperty(view, 0, { color: "blue" }).value, 92 "blue", 93 "Should have correct property value" 94 ); 95 96 is( 97 getTextProperty(view, 0, { color: "indigo" }).name, 98 "color", 99 "Should have correct property name" 100 ); 101 is( 102 getTextProperty(view, 0, { color: "indigo" }).value, 103 "indigo", 104 "Should have correct property value" 105 ); 106 107 is( 108 getTextProperty(view, 0, { color: "violet" }).name, 109 "color", 110 "Should have correct property name" 111 ); 112 is( 113 getTextProperty(view, 0, { color: "violet" }).value, 114 "violet", 115 "Should have correct property value" 116 ); 117 });