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 testCreateNewMulti(inspector, ruleEditor);
michael@0: });
michael@0:
michael@0: function* testCreateNewMulti(inspector, ruleEditor) {
michael@0: yield createNewRuleViewProperty(ruleEditor,
michael@0: "color:blue;background : orange ; text-align:center; border-color: green;");
michael@0:
michael@0: is(ruleEditor.rule.textProps.length, 4, "Should have created a new text property.");
michael@0: is(ruleEditor.propertyList.children.length, 5, "Should have created a new property editor.");
michael@0:
michael@0: is(ruleEditor.rule.textProps[0].name, "color", "Should have correct property name");
michael@0: is(ruleEditor.rule.textProps[0].value, "blue", "Should have correct property value");
michael@0:
michael@0: is(ruleEditor.rule.textProps[1].name, "background", "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, "text-align", "Should have correct property name");
michael@0: is(ruleEditor.rule.textProps[2].value, "center", "Should have correct property value");
michael@0:
michael@0: is(ruleEditor.rule.textProps[3].name, "border-color", "Should have correct property name");
michael@0: is(ruleEditor.rule.textProps[3].value, "green", "Should have correct property value");
michael@0:
michael@0: yield inspector.once("inspector-updated");
michael@0: }