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

Side by Side 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, 4 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
« 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 »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 <html>
2 <head>
3 <script src="../../http/tests/inspector/inspector-test.js"></script>
4 <script src="../../http/tests/inspector/console-test.js"></script>
5 <script>
6
7 function templateString()
8 {
9 console.log("The template string should not run and you should not see this log");
10 return {
11 shouldNotFindThis:56
12 };
13 }
14
15 function test()
16 {
17 function testCompletions(base, prefix, expected)
18 {
19 var callback;
20 var promise = new Promise(fulfill => callback = fulfill);
21 var div = document.createElement("div");
22 var text = base + prefix;
23 div.textContent = text;
24 var range = document.createRange();
25 range.setStart(div.childNodes[0], base.length);
26 range.setEnd(div.childNodes[0], text.length);
27 WebInspector.ExecutionContextSelector.completionsForTextPromptInCurrentC ontext(div, range, false, checkExpected);
28 return promise;
29
30 function checkExpected(completions)
31 {
32 InspectorTest.addResult("Checking '" + base + prefix + "'");
33 for (var i = 0; i < expected.length; i++)
34 InspectorTest.addResult(((completions.indexOf(expected[i]) !== - 1) ? "Found" : "Not Found") + ": " + expected[i]);
35 InspectorTest.addResult("");
36 callback();
37 }
38 }
39 function sequential(tests)
40 {
41 var promise = Promise.resolve();
42 for (var i = 0; i < tests.length; i++)
43 promise = promise.then(tests[i]);
44 return promise;
45 }
46
47 sequential([
48 () => testCompletions("window.", "do", ["document"]),
49 () => testCompletions("", "win", ["window"]),
50 () => testCompletions("window[", '"doc', ['"document"]']),
51 () => testCompletions('window["document"].', "bo", ["body"]),
52 () => testCompletions('window["document"]["body"].', "textC", ["textCont ent"]),
53 () => testCompletions('document.body.', "inner", ["innerText", "innerHTM L"]),
54 () => testCompletions('document["body"][window.', "do", ["document"]),
55 () => testCompletions('document["body"][window["document"].body.childNod es[0].', "text", ["textContent"]),
56 () => testCompletions("templateString`asdf`", "should", ["shouldNotFindT his"])
57 ]).then(InspectorTest.completeTest);
58
59 }
60 </script>
61 </head>
62 <body onload="runTest()">
63 <p>Tests that console correctly finds suggestions in complicated cases.</p>
64 </body>
65 </html>
OLDNEW
« 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