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

Unified Diff: third_party/WebKit/LayoutTests/http/tests/inspector-unit/text-prompt.js

Issue 2513423003: DevTools: Convert inspector-unit tests to use reusable test harness (Closed)
Patch Set: Moved type definition out of externs Created 4 years 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: third_party/WebKit/LayoutTests/http/tests/inspector-unit/text-prompt.js
diff --git a/third_party/WebKit/LayoutTests/http/tests/inspector-unit/text-prompt.js b/third_party/WebKit/LayoutTests/http/tests/inspector-unit/text-prompt.js
new file mode 100644
index 0000000000000000000000000000000000000000..9712fe2299c7eb53c71b733a14b5af59ba0ec8d9
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/http/tests/inspector-unit/text-prompt.js
@@ -0,0 +1,26 @@
+TestRunner.addResult("This tests if the TextPrompt autocomplete works properly.");
+
+var suggestions = ["heyoo", "hey it's a suggestion", "hey another suggestion"].map(s => ({title: s}));
+var prompt = new UI.TextPrompt();
+prompt.initialize(() => Promise.resolve(suggestions));
+var div = document.createElement("div");
+UI.inspectorView.element.appendChild(div);
+prompt.attachAndStartEditing(div);
+prompt.setText("hey");
+TestRunner.addSniffer(prompt, "_completionsReady").then(step2);
+prompt.complete();
+function step2() {
+ TestRunner.addResult("Text:" + prompt.text());
+ TestRunner.addResult("TextWithCurrentSuggestion:" + prompt.textWithCurrentSuggestion());
+
+ TestRunner.addResult("Test with inexact match:");
+ prompt.clearAutocomplete();
+ prompt.setText("inexactmatch");
+ TestRunner.addSniffer(prompt, "_completionsReady").then(step3);
+ prompt.complete();
+}
+function step3() {
+ TestRunner.addResult("Text:" + prompt.text());
+ TestRunner.addResult("TextWithCurrentSuggestion:" + prompt.textWithCurrentSuggestion());
+ TestRunner.completeTest();
+}

Powered by Google App Engine
This is Rietveld 408576698