| 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..5dca59d8889eea3aaf9bbc3ee09a1456c18e9270
|
| --- /dev/null
|
| +++ b/third_party/WebKit/LayoutTests/http/tests/inspector-unit/text-prompt.js
|
| @@ -0,0 +1,26 @@
|
| +UnitTest.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");
|
| +UnitTest.addSniffer(prompt, "_completionsReady").then(step2);
|
| +prompt.complete();
|
| +function step2() {
|
| + UnitTest.addResult("Text:" + prompt.text());
|
| + UnitTest.addResult("TextWithCurrentSuggestion:" + prompt.textWithCurrentSuggestion());
|
| +
|
| + UnitTest.addResult("Test with inexact match:");
|
| + prompt.clearAutocomplete();
|
| + prompt.setText("inexactmatch");
|
| + UnitTest.addSniffer(prompt, "_completionsReady").then(step3);
|
| + prompt.complete();
|
| +}
|
| +function step3() {
|
| + UnitTest.addResult("Text:" + prompt.text());
|
| + UnitTest.addResult("TextWithCurrentSuggestion:" + prompt.textWithCurrentSuggestion());
|
| + UnitTest.completeTest();
|
| +}
|
|
|