OLD | NEW |
| (Empty) |
1 <html> | |
2 <head> | |
3 <script src="../../../http/tests/inspector/inspector-test.js"></script> | |
4 <script src="../../../http/tests/inspector/elements-test.js"></script> | |
5 <script> | |
6 | |
7 function test() | |
8 { | |
9 InspectorTest.runTestSuite([ | |
10 function init(next) | |
11 { | |
12 InspectorTest.selectNodeAndWaitForStyles("inspected1", next); | |
13 }, | |
14 | |
15 function editKeywordAsOriginal(next) | |
16 { | |
17 startEditingAndDumpValue(WebInspector.Color.Format.Original, "border
", next); | |
18 }, | |
19 | |
20 function editKeywordAsHex(next) | |
21 { | |
22 startEditingAndDumpValue(WebInspector.Color.Format.HEX, "border", ne
xt); | |
23 }, | |
24 | |
25 function editKeywordAsHSL(next) | |
26 { | |
27 startEditingAndDumpValue(WebInspector.Color.Format.HSL, "border", ne
xt); | |
28 }, | |
29 | |
30 function editKeywordAsRGB(next) | |
31 { | |
32 startEditingAndDumpValue(WebInspector.Color.Format.RGB, "border", on
ValueDumped); | |
33 function onValueDumped() | |
34 { | |
35 InspectorTest.selectNodeAndWaitForStyles("inspected2", next); | |
36 } | |
37 }, | |
38 | |
39 function editHexAsOriginal(next) | |
40 { | |
41 startEditingAndDumpValue(WebInspector.Color.Format.Original, "color"
, next); | |
42 }, | |
43 | |
44 function editHexAsHex(next) | |
45 { | |
46 startEditingAndDumpValue(WebInspector.Color.Format.HEX, "color", nex
t); | |
47 }, | |
48 | |
49 function editHexAsHSL(next) | |
50 { | |
51 startEditingAndDumpValue(WebInspector.Color.Format.HSL, "color", nex
t); | |
52 }, | |
53 | |
54 function editHexAsRGB(next) | |
55 { | |
56 startEditingAndDumpValue(WebInspector.Color.Format.RGB, "color", nex
t); | |
57 }, | |
58 | |
59 function editNewProperty(next) | |
60 { | |
61 var section = InspectorTest.inlineStyleSection(); | |
62 | |
63 treeElement = section.addNewBlankProperty(0); | |
64 treeElement.startEditing(); | |
65 treeElement.nameElement.textContent = "border-color"; | |
66 treeElement.nameElement.dispatchEvent(InspectorTest.createKeyEvent("
Enter")); | |
67 treeElement.valueElement.textContent = "hsl(120, 100%, 25%)"; | |
68 treeElement.kickFreeFlowStyleEditForTest(); | |
69 InspectorTest.waitForStyleApplied(kicked); | |
70 | |
71 function kicked() | |
72 { | |
73 treeElement.valueElement.dispatchEvent(InspectorTest.createKeyEv
ent("U+0009", false, false, true)); | |
74 treeElement.nameElement.dispatchEvent(InspectorTest.createKeyEve
nt("U+0009")); | |
75 InspectorTest.addResult(treeElement.valueElement.textContent); | |
76 next(); | |
77 } | |
78 } | |
79 ]); | |
80 | |
81 function setFormat(newFormat, callback) | |
82 { | |
83 WebInspector.settingForTest("colorFormat").set(newFormat); | |
84 WebInspector.panels.elements.sidebarPanes.styles.doUpdate(callback); | |
85 } | |
86 | |
87 function startEditingAndDumpValue(format, propertyName, next) | |
88 { | |
89 setFormat(format, onFormatSet); | |
90 | |
91 function onFormatSet() | |
92 { | |
93 var treeElement = InspectorTest.getElementStylePropertyTreeItem(prop
ertyName); | |
94 treeElement.startEditing(treeElement.valueElement); | |
95 InspectorTest.addResult(treeElement.valueElement.textContent); | |
96 treeElement.valueElement.dispatchEvent(InspectorTest.createKeyEvent(
"U+001B")); | |
97 next(); | |
98 } | |
99 } | |
100 } | |
101 | |
102 </script> | |
103 </head> | |
104 | |
105 <body onload="runTest()"> | |
106 <p> | |
107 Tests that property value being edited uses the user-specified color format. | |
108 </p> | |
109 | |
110 <div id="inspected1" style="border: 1px solid red">inspected1</div> | |
111 <div id="inspected2" style="color: #ffffee">inspected2</div> | |
112 | |
113 </body> | |
114 </html> | |
OLD | NEW |