michael@0: /* vim: set ft=javascript ts=2 et sw=2 tw=80: */ michael@0: /* Any copyright is dedicated to the Public Domain. michael@0: http://creativecommons.org/publicdomain/zero/1.0/ */ michael@0: michael@0: "use strict"; michael@0: michael@0: // Test that the rule-view behaves correctly when entering mutliple and/or michael@0: // unfinished properties/values in inplace-editors michael@0: michael@0: let test = asyncTest(function*() { michael@0: yield addTab("data:text/html,test rule view user changes"); michael@0: content.document.body.innerHTML = "

Testing Multiple Properties

"; michael@0: let {toolbox, inspector, view} = yield openRuleView(); michael@0: michael@0: info("Creating the test element"); michael@0: let newElement = content.document.createElement("div"); michael@0: newElement.textContent = "Test Element"; michael@0: content.document.body.appendChild(newElement); michael@0: yield selectNode(newElement, inspector); michael@0: let ruleEditor = view.element.children[0]._ruleEditor; michael@0: michael@0: yield testCreateNewMultiDuplicates(inspector, ruleEditor); michael@0: }); michael@0: michael@0: function* testCreateNewMultiDuplicates(inspector, ruleEditor) { michael@0: yield createNewRuleViewProperty(ruleEditor, michael@0: "color:red;color:orange;color:yellow;color:green;color:blue;color:indigo;color:violet;"); michael@0: michael@0: is(ruleEditor.rule.textProps.length, 7, "Should have created new text properties."); michael@0: is(ruleEditor.propertyList.children.length, 8, "Should have created new property editors."); michael@0: michael@0: is(ruleEditor.rule.textProps[0].name, "color", "Should have correct property name"); michael@0: is(ruleEditor.rule.textProps[0].value, "red", "Should have correct property value"); michael@0: michael@0: is(ruleEditor.rule.textProps[1].name, "color", "Should have correct property name"); michael@0: is(ruleEditor.rule.textProps[1].value, "orange", "Should have correct property value"); michael@0: michael@0: is(ruleEditor.rule.textProps[2].name, "color", "Should have correct property name"); michael@0: is(ruleEditor.rule.textProps[2].value, "yellow", "Should have correct property value"); michael@0: michael@0: is(ruleEditor.rule.textProps[3].name, "color", "Should have correct property name"); michael@0: is(ruleEditor.rule.textProps[3].value, "green", "Should have correct property value"); michael@0: michael@0: is(ruleEditor.rule.textProps[4].name, "color", "Should have correct property name"); michael@0: is(ruleEditor.rule.textProps[4].value, "blue", "Should have correct property value"); michael@0: michael@0: is(ruleEditor.rule.textProps[5].name, "color", "Should have correct property name"); michael@0: is(ruleEditor.rule.textProps[5].value, "indigo", "Should have correct property value"); michael@0: michael@0: is(ruleEditor.rule.textProps[6].name, "color", "Should have correct property name"); michael@0: is(ruleEditor.rule.textProps[6].value, "violet", "Should have correct property value"); michael@0: michael@0: yield inspector.once("inspector-updated"); michael@0: }