| OLD | NEW |
| (Empty) | |
| 1 TestRunner.addResult("This tests if the TextPrompt autocomplete works properly."
); |
| 2 |
| 3 var suggestions = ["heyoo", "hey it's a suggestion", "hey another suggestion"].m
ap(s => ({title: s})); |
| 4 var prompt = new UI.TextPrompt(); |
| 5 prompt.initialize(() => Promise.resolve(suggestions)); |
| 6 var div = document.createElement("div"); |
| 7 UI.inspectorView.element.appendChild(div); |
| 8 prompt.attachAndStartEditing(div); |
| 9 prompt.setText("hey"); |
| 10 TestRunner.addSniffer(prompt, "_completionsReady").then(step2); |
| 11 prompt.complete(); |
| 12 function step2() { |
| 13 TestRunner.addResult("Text:" + prompt.text()); |
| 14 TestRunner.addResult("TextWithCurrentSuggestion:" + prompt.textWithCurrentSu
ggestion()); |
| 15 |
| 16 TestRunner.addResult("Test with inexact match:"); |
| 17 prompt.clearAutocomplete(); |
| 18 prompt.setText("inexactmatch"); |
| 19 TestRunner.addSniffer(prompt, "_completionsReady").then(step3); |
| 20 prompt.complete(); |
| 21 } |
| 22 function step3() { |
| 23 TestRunner.addResult("Text:" + prompt.text()); |
| 24 TestRunner.addResult("TextWithCurrentSuggestion:" + prompt.textWithCurrentSu
ggestion()); |
| 25 TestRunner.completeTest(); |
| 26 } |
| OLD | NEW |