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

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

Issue 1158883003: DevTools: shard inspector/elements tests for faster execution. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 6 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 | Annotate | Revision Log
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 var prompt = new WebInspector.StylesSidebarPane.CSSPropertyPrompt(WebInspect or.CSSMetadata.cssPropertiesMetainfo, null, true);
10
11 InspectorTest.runTestSuite([
12 function testForUpperCase(next)
13 {
14 testAutoCompletionsAgainstCase(prompt, "C", next);
15 },
16
17 function testForLowerCase(next)
18 {
19 testAutoCompletionsAgainstCase(prompt, "b", next);
20 },
21
22 function testForMixedCase(next)
23 {
24 testAutoCompletionsAgainstCase(prompt, "bAcK", next);
25 }
26 ]);
27
28 function testAutoCompletionsAgainstCase(prompt, inputText, callback)
29 {
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, com pletions);
35
36 function completions(result, index)
37 {
38 function isUpperCase(str)
39 {
40 return str === str.toUpperCase();
41 }
42
43 function isLowerCase(str)
44 {
45 return str === str.toLowerCase();
46 }
47
48 var Case = {
49 Upper: 0,
50 Lower: 1,
51 Mixed: 2
52 };
53
54 var inputCase = isUpperCase(inputText) ? Case.Upper : isLowerCase(in putText) ? Case.Lower : Case.Mixed;
55
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;
66 }
67 }
68 proxyElement.remove();
69 callback();
70 }
71 }
72 }
73 </script>
74 </head>
75
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>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698