Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / inspector / elements / styles-1 / case-sensitive-suggestions.html
blob8d39dd774d899c80f6c474606fb9d3cce146c594
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>
7 function test()
9 var prompt = new WebInspector.StylesSidebarPane.CSSPropertyPrompt(WebInspector.CSSMetadata.cssPropertiesMetainfo, null, true);
11 InspectorTest.runTestSuite([
12 function testForUpperCase(next)
14 testAutoCompletionsAgainstCase(prompt, "C", next);
17 function testForLowerCase(next)
19 testAutoCompletionsAgainstCase(prompt, "b", next);
22 function testForMixedCase(next)
24 testAutoCompletionsAgainstCase(prompt, "bAcK", next);
26 ]);
28 function testAutoCompletionsAgainstCase(prompt, inputText, callback)
30 var proxyElement = document.body.createChild("span");
31 proxyElement.textContent = inputText;
32 var selectionRange = document.createRange();
33 selectionRange.selectNodeContents(proxyElement);
34 prompt._buildPropertyCompletions(proxyElement, selectionRange, true, completions);
36 function completions(result, index)
38 function isUpperCase(str)
40 return str === str.toUpperCase();
43 function isLowerCase(str)
45 return str === str.toLowerCase();
48 var Case = {
49 Upper: 0,
50 Lower: 1,
51 Mixed: 2
54 var inputCase = isUpperCase(inputText) ? Case.Upper : isLowerCase(inputText) ? Case.Lower : Case.Mixed;
56 for (var i = 0; i < result.length; ++i) {
57 switch (inputCase) {
58 case Case.Upper:
59 if (!isUpperCase(result[i]))
60 InspectorTest.addResult("Error: Suggestion " + result[i] + " must be in UPPERCASE.");
61 break;
62 case Case.Lower:
63 if (!isLowerCase(result[i]))
64 InspectorTest.addResult("Error: Suggestion " + result[i] + " must be in lowercase.");
65 break;
68 proxyElement.remove();
69 callback();
73 </script>
74 </head>
76 <body onload="runTest()">
77 <p>
78 Tests that text prompt suggestions' casing follows that of the user input.
79 </p>
80 </body>
81 </html>