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

Unified Diff: third_party/WebKit/LayoutTests/inspector/console/console-correct-suggestions.html

Issue 2163393002: DevTools: Give autocomplete suggestions even after brackets (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Nicer sequential Created 4 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
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/inspector/console/console-correct-suggestions-expected.txt » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/LayoutTests/inspector/console/console-correct-suggestions.html
diff --git a/third_party/WebKit/LayoutTests/inspector/console/console-correct-suggestions.html b/third_party/WebKit/LayoutTests/inspector/console/console-correct-suggestions.html
new file mode 100644
index 0000000000000000000000000000000000000000..a10e7b52954f2c13f94d7c6dfed97486e9d0999a
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/inspector/console/console-correct-suggestions.html
@@ -0,0 +1,65 @@
+<html>
+<head>
+<script src="../../http/tests/inspector/inspector-test.js"></script>
+<script src="../../http/tests/inspector/console-test.js"></script>
+<script>
+
+function templateString()
+{
+ console.log("The template string should not run and you should not see this log");
+ return {
+ shouldNotFindThis:56
+ };
+}
+
+function test()
+{
+ function testCompletions(base, prefix, expected)
+ {
+ var callback;
+ var promise = new Promise(fulfill => callback = fulfill);
+ var div = document.createElement("div");
+ var text = base + prefix;
+ div.textContent = text;
+ var range = document.createRange();
+ range.setStart(div.childNodes[0], base.length);
+ range.setEnd(div.childNodes[0], text.length);
+ WebInspector.ExecutionContextSelector.completionsForTextPromptInCurrentContext(div, range, false, checkExpected);
+ return promise;
+
+ function checkExpected(completions)
+ {
+ InspectorTest.addResult("Checking '" + base + prefix + "'");
+ for (var i = 0; i < expected.length; i++)
+ InspectorTest.addResult(((completions.indexOf(expected[i]) !== -1) ? "Found" : "Not Found") + ": " + expected[i]);
+ InspectorTest.addResult("");
+ callback();
+ }
+ }
+ function sequential(tests)
+ {
+ var promise = Promise.resolve();
+ for (var i = 0; i < tests.length; i++)
+ promise = promise.then(tests[i]);
+ return promise;
+ }
+
+ sequential([
+ () => testCompletions("window.", "do", ["document"]),
+ () => testCompletions("", "win", ["window"]),
+ () => testCompletions("window[", '"doc', ['"document"]']),
+ () => testCompletions('window["document"].', "bo", ["body"]),
+ () => testCompletions('window["document"]["body"].', "textC", ["textContent"]),
+ () => testCompletions('document.body.', "inner", ["innerText", "innerHTML"]),
+ () => testCompletions('document["body"][window.', "do", ["document"]),
+ () => testCompletions('document["body"][window["document"].body.childNodes[0].', "text", ["textContent"]),
+ () => testCompletions("templateString`asdf`", "should", ["shouldNotFindThis"])
+ ]).then(InspectorTest.completeTest);
+
+}
+</script>
+</head>
+<body onload="runTest()">
+<p>Tests that console correctly finds suggestions in complicated cases.</p>
+</body>
+</html>
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/inspector/console/console-correct-suggestions-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698