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 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 }, | |
apavlov
2014/07/14 12:23:42
we try to avoid dangling commas, unlike Python/GYP
| |
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 are case sensitive, either UPPERCASE or lower case, to user input. | |
apavlov
2014/07/14 12:23:42
Tests that text prompt suggestions' casing follows
| |
80 </p> | |
81 </body> | |
82 </html> | |
OLD | NEW |