3 <script src=
"../../../http/tests/inspector/inspector-test.js"></script>
4 <script src=
"../../../http/tests/inspector/elements-test.js"></script>
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
);
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();
54 var inputCase
= isUpperCase(inputText
) ? Case
.Upper
: isLowerCase(inputText
) ? Case
.Lower
: Case
.Mixed
;
56 for (var i
= 0; i
< result
.length
; ++i
) {
59 if (!isUpperCase(result
[i
]))
60 InspectorTest
.addResult("Error: Suggestion " + result
[i
] + " must be in UPPERCASE.");
63 if (!isLowerCase(result
[i
]))
64 InspectorTest
.addResult("Error: Suggestion " + result
[i
] + " must be in lowercase.");
68 proxyElement
.remove();
76 <body onload=
"runTest()">
78 Tests that text prompt suggestions' casing follows that of the user input.