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

Unified 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: Patch for landing! 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 side-by-side diff with in-line comments
Download patch
Index: LayoutTests/inspector/elements/styles/case-sensitive-suggestions.html
diff --git a/LayoutTests/inspector/elements/styles/case-sensitive-suggestions.html b/LayoutTests/inspector/elements/styles/case-sensitive-suggestions.html
new file mode 100644
index 0000000000000000000000000000000000000000..40b49010e9a0981b04b591b66c113618522773e2
--- /dev/null
+++ b/LayoutTests/inspector/elements/styles/case-sensitive-suggestions.html
@@ -0,0 +1,82 @@
+<html>
+<head>
+<script src="../../../http/tests/inspector/inspector-test.js"></script>
+<script src="../../../http/tests/inspector/elements-test.js"></script>
+<script>
+
+function test()
+{
+ WebInspector.inspectorView.showPanel("elements");
+ var prompt = new WebInspector.StylesSidebarPane.CSSPropertyPrompt(WebInspector.CSSMetadata.cssPropertiesMetainfo, null, true);
+
+ InspectorTest.runTestSuite([
+ function testForUpperCase(next)
+ {
+ testAutoCompletionsAgainstCase(prompt, "C", next);
+ },
+
+ function testForLowerCase(next)
+ {
+ testAutoCompletionsAgainstCase(prompt, "b", next);
+ },
+
+ function testForMixedCase(next)
+ {
+ testAutoCompletionsAgainstCase(prompt, "bAcK", next);
+ },
apavlov 2014/07/14 12:23:42 we try to avoid dangling commas, unlike Python/GYP
+ ]);
+
+ function testAutoCompletionsAgainstCase(prompt, inputText, callback)
+ {
+ var proxyElement = document.body.createChild("span");
+ proxyElement.textContent = inputText;
+ var selectionRange = document.createRange();
+ selectionRange.selectNodeContents(proxyElement);
+ prompt._buildPropertyCompletions(proxyElement, selectionRange, true, completions);
+
+ function completions(result, index)
+ {
+ function isUpperCase(str)
+ {
+ return str === str.toUpperCase();
+ }
+
+ function isLowerCase(str)
+ {
+ return str === str.toLowerCase();
+ }
+
+ var Case = {
+ Upper: 0,
+ Lower: 1,
+ Mixed: 2
+ };
+
+ var inputCase = isUpperCase(inputText) ? Case.Upper : isLowerCase(inputText) ? Case.Lower : Case.Mixed;
+
+ for (var i = 0; i < result.length; ++i) {
+ switch (inputCase) {
+ case Case.Upper:
+ if (!isUpperCase(result[i]))
+ InspectorTest.addResult("Error: Suggestion " + result[i] + " must be in UPPERCASE.");
+ break;
+ case Case.Lower:
+ if (!isLowerCase(result[i]))
+ InspectorTest.addResult("Error: Suggestion " + result[i] + " must be in lowercase.");
+ break;
+ }
+ }
+ proxyElement.remove();
+ callback();
+ }
+ }
+}
+</script>
+</head>
+
+<body onload="runTest()">
+<p>
+Tests that text prompt suggestions are case sensitive, either UPPERCASE or lowercase, to user input.
apavlov 2014/07/14 12:23:42 Tests that text prompt suggestions' casing follows
+</p>
+</body>
+</html>

Powered by Google App Engine
This is Rietveld 408576698