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

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

Issue 2480423002: DevTools: Use CodeMirror syntax highlighting to improve JS autocomplete (Closed)
Patch Set: CurrentTokenType Created 4 years, 1 month 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
index 06f1071a68e735760b5e87792fa5f2645fb70496..4d826eb029cee45a963141389ce58da89d7a72c5 100644
--- a/third_party/WebKit/LayoutTests/inspector/console/console-correct-suggestions.html
+++ b/third_party/WebKit/LayoutTests/inspector/console/console-correct-suggestions.html
@@ -13,20 +13,24 @@ function templateString()
function test()
{
- function testCompletions(base, prefix, expected)
+ var consoleEditor;
+ function testCompletions(text, expected, force)
{
- var callback;
- var promise = new Promise(fulfill => callback = fulfill);
- WebInspector.JavaScriptAutocomplete.completionsForTextInCurrentContext(base, prefix).then(checkExpected);
- return promise;
+ consoleEditor.setText(text);
+ consoleEditor.setSelection(WebInspector.TextRange.createFromLocation(Infinity, Infinity));
+ consoleEditor._autocompleteController.autocomplete(force);
+ return InspectorTest.addSnifferPromise(consoleEditor._autocompleteController, "_onSuggestionsShownForTest").then(checkExpected);
- function checkExpected(completions)
+ function checkExpected(suggestions)
{
- InspectorTest.addResult("Checking '" + base + prefix + "'");
+ var completions = new Set(suggestions.map(suggestion => suggestion.title));
+ var message = "Checking '" + text + "'";
+ if (force)
+ message += " forcefully";
+ InspectorTest.addResult(message);
for (var i = 0; i < expected.length; i++)
- InspectorTest.addResult(((completions.indexOf(expected[i]) !== -1) ? "Found" : "Not Found") + ": " + expected[i]);
+ InspectorTest.addResult((completions.has(expected[i]) ? "Found" : "Not Found") + ": " + expected[i]);
InspectorTest.addResult("");
- callback();
}
}
function sequential(tests)
@@ -38,20 +42,27 @@ function test()
}
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"]),
- () => testCompletions("window.document.", "BODY", ["body"]),
- () => testCompletions("window.", "dOcUmE", ["document"]),
- () => testCompletions("window.", "node", ["NodeList", "AudioNode", "GainNode"]),
- () => testCompletions("", "32", ["Float32Array", "Int32Array"]),
- () => testCompletions("window.", "32", ["Float32Array", "Int32Array"])
+ InspectorTest.waitUntilConsoleEditorLoaded().then(e => consoleEditor = e),
+ () => 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"]),
+ () => testCompletions("window.document.BODY", ["body"]),
+ () => testCompletions("window.dOcUmE", ["document"]),
+ () => testCompletions("window.node", ["NodeList", "AudioNode", "GainNode"]),
+ () => testCompletions("32", ["Float32Array", "Int32Array"]),
+ () => testCompletions("window.32", ["Float32Array", "Int32Array"]),
+ () => testCompletions("", ["window"], false),
+ () => testCompletions("", ["window"], true),
+ () => testCompletions('"string g', ["getComputedStyle"], false),
+ () => testCompletions("`template string docu", ["document"], false),
+ () => testCompletions("`${do", ["document"], false),
+ () => testCompletions("// do", ["document"], false)
]).then(InspectorTest.completeTest);
}
« 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