| OLD | NEW |
| 1 <html> | 1 <html> |
| 2 <head> | 2 <head> |
| 3 <script src="../../../http/tests/inspector/inspector-test.js"></script> | 3 <script src="../../../http/tests/inspector/inspector-test.js"></script> |
| 4 <script src="../../../http/tests/inspector/elements-test.js"></script> | 4 <script src="../../../http/tests/inspector/elements-test.js"></script> |
| 5 <script> | 5 <script> |
| 6 | 6 |
| 7 function test() | 7 function test() |
| 8 { | 8 { |
| 9 var namePrompt = new Elements.StylesSidebarPane.CSSPropertyPrompt(SDK.cssMet
adata().allProperties(), null, true); | 9 var namePrompt = new Elements.StylesSidebarPane.CSSPropertyPrompt(SDK.cssMet
adata().allProperties(), ['--red-color', '--blue-color'], null, true); |
| 10 var valuePrompt = valuePromptFor("color"); | 10 var valuePrompt = valuePromptFor("color"); |
| 11 | 11 |
| 12 function valuePromptFor(name) | 12 function valuePromptFor(name) |
| 13 { | 13 { |
| 14 return new Elements.StylesSidebarPane.CSSPropertyPrompt(SDK.cssMetadata(
).propertyValues(name), null, false); | 14 return new Elements.StylesSidebarPane.CSSPropertyPrompt(SDK.cssMetadata(
).propertyValues(name), ['--red-color', '--blue-color'], null, false); |
| 15 } | 15 } |
| 16 | 16 |
| 17 InspectorTest.runTestSuite([ | 17 InspectorTest.runTestSuite([ |
| 18 function testEmptyName(next) | 18 function testEmptyName(next) |
| 19 { | 19 { |
| 20 testAgainstGolden(namePrompt, "", false, [], ["width"], next); | 20 testAgainstGolden(namePrompt, "", false, [], ["width"], next); |
| 21 }, | 21 }, |
| 22 | 22 |
| 23 function testEmptyNameForce(next) | 23 function testEmptyNameForce(next) |
| 24 { | 24 { |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 66 }, | 66 }, |
| 67 | 67 |
| 68 function testValueUnprefixed(next) | 68 function testValueUnprefixed(next) |
| 69 { | 69 { |
| 70 testAgainstGolden(valuePromptFor("transform"), "tr", false, ["transl
ate", "translateY", "translate3d"], ["initial", "inherit"], next); | 70 testAgainstGolden(valuePromptFor("transform"), "tr", false, ["transl
ate", "translateY", "translate3d"], ["initial", "inherit"], next); |
| 71 }, | 71 }, |
| 72 | 72 |
| 73 function testValueSubstring(next) | 73 function testValueSubstring(next) |
| 74 { | 74 { |
| 75 testAgainstGolden(valuePromptFor("color"), "blue", false, ["blue", "
darkblue", "lightblue"], ["darkred", "yellow", "initial", "inherit"], next); | 75 testAgainstGolden(valuePromptFor("color"), "blue", false, ["blue", "
darkblue", "lightblue"], ["darkred", "yellow", "initial", "inherit"], next); |
| 76 }, |
| 77 |
| 78 function testNameVariables(next) |
| 79 { |
| 80 testAgainstGolden(namePrompt, "", true, ["--red-color", "--blue-colo
r"], [], next); |
| 81 }, |
| 82 |
| 83 function testValueVariables(next) |
| 84 { |
| 85 testAgainstGolden(valuePromptFor("color"), "var(", true, ["--red-col
or)", "--blue-color)"], ["width"], next); |
| 76 } | 86 } |
| 77 ]); | 87 ]); |
| 78 | 88 |
| 79 function testAgainstGolden(prompt, inputText, force, golden, antiGolden, cal
lback) | 89 function testAgainstGolden(prompt, inputText, force, golden, antiGolden, cal
lback) |
| 80 { | 90 { |
| 81 var proxyElement = document.createElement("div"); | 91 var proxyElement = document.createElement("div"); |
| 82 document.body.appendChild(proxyElement); | 92 document.body.appendChild(proxyElement); |
| 83 proxyElement.style = "webkit-user-select: text; -webkit-user-modify: rea
d-write-plaintext-only"; | 93 proxyElement.style = "webkit-user-select: text; -webkit-user-modify: rea
d-write-plaintext-only"; |
| 84 proxyElement.textContent = inputText; | 94 proxyElement.textContent = inputText; |
| 85 var selectionRange = document.createRange(); | 95 var selectionRange = document.createRange(); |
| (...skipping 27 matching lines...) Expand all Loading... |
| 113 } | 123 } |
| 114 </script> | 124 </script> |
| 115 </head> | 125 </head> |
| 116 | 126 |
| 117 <body onload="runTest()"> | 127 <body onload="runTest()"> |
| 118 <p> | 128 <p> |
| 119 Tests that autocompletions are computed correctly when editing the Styles pane. | 129 Tests that autocompletions are computed correctly when editing the Styles pane. |
| 120 </p> | 130 </p> |
| 121 </body> | 131 </body> |
| 122 </html> | 132 </html> |
| OLD | NEW |