|
1 /* vim: set ft=javascript ts=2 et sw=2 tw=80: */ |
|
2 /* Any copyright is dedicated to the Public Domain. |
|
3 http://creativecommons.org/publicdomain/zero/1.0/ */ |
|
4 |
|
5 "use strict"; |
|
6 |
|
7 // Test that the rule-view behaves correctly when entering mutliple and/or |
|
8 // unfinished properties/values in inplace-editors |
|
9 |
|
10 let test = asyncTest(function*() { |
|
11 yield addTab("data:text/html,test rule view user changes"); |
|
12 content.document.body.innerHTML = "<h1>Testing Multiple Properties</h1>"; |
|
13 let {toolbox, inspector, view} = yield openRuleView(); |
|
14 |
|
15 info("Creating the test element"); |
|
16 let newElement = content.document.createElement("div"); |
|
17 newElement.textContent = "Test Element"; |
|
18 content.document.body.appendChild(newElement); |
|
19 yield selectNode(newElement, inspector); |
|
20 let ruleEditor = view.element.children[0]._ruleEditor; |
|
21 |
|
22 yield testCreateNewMultiUnfinished(inspector, ruleEditor, view); |
|
23 }); |
|
24 |
|
25 function* testCreateNewMultiUnfinished(inspector, ruleEditor, view) { |
|
26 yield createNewRuleViewProperty(ruleEditor, |
|
27 "color:blue;background : orange ; text-align:center; border-color: "); |
|
28 |
|
29 is(ruleEditor.rule.textProps.length, 4, "Should have created new text properties."); |
|
30 is(ruleEditor.propertyList.children.length, 4, "Should have created property editors."); |
|
31 |
|
32 for (let ch of "red") { |
|
33 EventUtils.sendChar(ch, view.doc.defaultView); |
|
34 } |
|
35 EventUtils.synthesizeKey("VK_RETURN", {}, view.doc.defaultView); |
|
36 |
|
37 is(ruleEditor.rule.textProps.length, 4, "Should have the same number of text properties."); |
|
38 is(ruleEditor.propertyList.children.length, 5, "Should have added the changed value editor."); |
|
39 |
|
40 is(ruleEditor.rule.textProps[0].name, "color", "Should have correct property name"); |
|
41 is(ruleEditor.rule.textProps[0].value, "blue", "Should have correct property value"); |
|
42 |
|
43 is(ruleEditor.rule.textProps[1].name, "background", "Should have correct property name"); |
|
44 is(ruleEditor.rule.textProps[1].value, "orange", "Should have correct property value"); |
|
45 |
|
46 is(ruleEditor.rule.textProps[2].name, "text-align", "Should have correct property name"); |
|
47 is(ruleEditor.rule.textProps[2].value, "center", "Should have correct property value"); |
|
48 |
|
49 is(ruleEditor.rule.textProps[3].name, "border-color", "Should have correct property name"); |
|
50 is(ruleEditor.rule.textProps[3].value, "red", "Should have correct property value"); |
|
51 |
|
52 yield inspector.once("inspector-updated"); |
|
53 } |