Wed, 31 Dec 2014 06:09:35 +0100
Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.
michael@0 | 1 | /* vim: set ft=javascript ts=2 et sw=2 tw=80: */ |
michael@0 | 2 | /* Any copyright is dedicated to the Public Domain. |
michael@0 | 3 | http://creativecommons.org/publicdomain/zero/1.0/ */ |
michael@0 | 4 | |
michael@0 | 5 | "use strict"; |
michael@0 | 6 | |
michael@0 | 7 | // Test that the rule-view behaves correctly when entering mutliple and/or |
michael@0 | 8 | // unfinished properties/values in inplace-editors |
michael@0 | 9 | |
michael@0 | 10 | let test = asyncTest(function*() { |
michael@0 | 11 | yield addTab("data:text/html,test rule view user changes"); |
michael@0 | 12 | content.document.body.innerHTML = "<h1>Testing Multiple Properties</h1>"; |
michael@0 | 13 | let {toolbox, inspector, view} = yield openRuleView(); |
michael@0 | 14 | |
michael@0 | 15 | info("Creating the test element"); |
michael@0 | 16 | let newElement = content.document.createElement("div"); |
michael@0 | 17 | newElement.textContent = "Test Element"; |
michael@0 | 18 | content.document.body.appendChild(newElement); |
michael@0 | 19 | yield selectNode(newElement, inspector); |
michael@0 | 20 | let ruleEditor = view.element.children[0]._ruleEditor; |
michael@0 | 21 | |
michael@0 | 22 | yield testCreateNewMultiDuplicates(inspector, ruleEditor); |
michael@0 | 23 | }); |
michael@0 | 24 | |
michael@0 | 25 | function* testCreateNewMultiDuplicates(inspector, ruleEditor) { |
michael@0 | 26 | yield createNewRuleViewProperty(ruleEditor, |
michael@0 | 27 | "color:red;color:orange;color:yellow;color:green;color:blue;color:indigo;color:violet;"); |
michael@0 | 28 | |
michael@0 | 29 | is(ruleEditor.rule.textProps.length, 7, "Should have created new text properties."); |
michael@0 | 30 | is(ruleEditor.propertyList.children.length, 8, "Should have created new property editors."); |
michael@0 | 31 | |
michael@0 | 32 | is(ruleEditor.rule.textProps[0].name, "color", "Should have correct property name"); |
michael@0 | 33 | is(ruleEditor.rule.textProps[0].value, "red", "Should have correct property value"); |
michael@0 | 34 | |
michael@0 | 35 | is(ruleEditor.rule.textProps[1].name, "color", "Should have correct property name"); |
michael@0 | 36 | is(ruleEditor.rule.textProps[1].value, "orange", "Should have correct property value"); |
michael@0 | 37 | |
michael@0 | 38 | is(ruleEditor.rule.textProps[2].name, "color", "Should have correct property name"); |
michael@0 | 39 | is(ruleEditor.rule.textProps[2].value, "yellow", "Should have correct property value"); |
michael@0 | 40 | |
michael@0 | 41 | is(ruleEditor.rule.textProps[3].name, "color", "Should have correct property name"); |
michael@0 | 42 | is(ruleEditor.rule.textProps[3].value, "green", "Should have correct property value"); |
michael@0 | 43 | |
michael@0 | 44 | is(ruleEditor.rule.textProps[4].name, "color", "Should have correct property name"); |
michael@0 | 45 | is(ruleEditor.rule.textProps[4].value, "blue", "Should have correct property value"); |
michael@0 | 46 | |
michael@0 | 47 | is(ruleEditor.rule.textProps[5].name, "color", "Should have correct property name"); |
michael@0 | 48 | is(ruleEditor.rule.textProps[5].value, "indigo", "Should have correct property value"); |
michael@0 | 49 | |
michael@0 | 50 | is(ruleEditor.rule.textProps[6].name, "color", "Should have correct property name"); |
michael@0 | 51 | is(ruleEditor.rule.textProps[6].value, "violet", "Should have correct property value"); |
michael@0 | 52 | |
michael@0 | 53 | yield inspector.once("inspector-updated"); |
michael@0 | 54 | } |