Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(51)

Side by Side Diff: LayoutTests/inspector/elements/styles/case-sensitive-suggestions.html

Issue 376803002: [DevTools] Color values should be case insensitive while suggestions should be case aware (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(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 WebInspector.inspectorView.showPanel("elements");
10 var prompt = new WebInspector.StylesSidebarPane.CSSPropertyPrompt(WebInspect or.CSSMetadata.cssPropertiesMetainfo, null, true);
11
12 InspectorTest.runTestSuite([
13 function testForUpperCase(next)
14 {
15 testAutoCompletionsAgainstCase(prompt, "C", next);
16 },
17
18 function testForLowerCase(next)
19 {
20 testAutoCompletionsAgainstCase(prompt, "b", next);
21 },
22
23 function testForMixedCase(next)
24 {
25 testAutoCompletionsAgainstCase(prompt, "bAcK", next);
26 }
27 ]);
28
29 function testAutoCompletionsAgainstCase(prompt, inputText, callback)
30 {
31 var proxyElement = document.body.createChild("span");
32 proxyElement.textContent = inputText;
33 var selectionRange = document.createRange();
34 selectionRange.selectNodeContents(proxyElement);
35 prompt._buildPropertyCompletions(proxyElement, selectionRange, true, com pletions);
36
37 function completions(result, index)
38 {
39 function isUpperCase(str)
40 {
41 return str === str.toUpperCase();
42 }
43
44 function isLowerCase(str)
45 {
46 return str === str.toLowerCase();
47 }
48
49 var Case = {
50 Upper: 0,
51 Lower: 1,
52 Mixed: 2
53 };
54
55 var inputCase = isUpperCase(inputText) ? Case.Upper : isLowerCase(in putText) ? Case.Lower : Case.Mixed;
56
57 for (var i = 0; i < result.length; ++i) {
58 switch (inputCase) {
59 case Case.Upper:
60 if (!isUpperCase(result[i]))
61 InspectorTest.addResult("Error: Suggestion " + result[i] + " must be in UPPERCASE.");
62 break;
63 case Case.Lower:
64 if (!isLowerCase(result[i]))
65 InspectorTest.addResult("Error: Suggestion " + result[i] + " must be in lowercase.");
66 break;
67 }
68 }
69 proxyElement.remove();
70 callback();
71 }
72 }
73 }
74 </script>
75 </head>
76
77 <body onload="runTest()">
78 <p>
79 Tests that text prompt suggestions' casing follows that of the user input.
80 </p>
81 </body>
82 </html>
OLDNEW
« no previous file with comments | « LayoutTests/FlakyTests ('k') | LayoutTests/inspector/elements/styles/case-sensitive-suggestions-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698