| OLD | NEW |
| (Empty) |
| 1 <html> | |
| 2 <head> | |
| 3 <base href="/inspector-debug/"></base> | |
| 4 <script src="/inspector-debug/Runtime.js"></script> | |
| 5 <script src="/inspector-unit/inspector-unit-test.js"></script> | |
| 6 <script> | |
| 7 function test() { | |
| 8 var suggestions = ["heyoo", "hey it's a suggestion", "hey another suggestion
"].map(s => ({title: s})); | |
| 9 var prompt = new UI.TextPrompt(); | |
| 10 prompt.initialize(() => Promise.resolve(suggestions)); | |
| 11 var div = document.createElement("div"); | |
| 12 UI.inspectorView.element.appendChild(div); | |
| 13 prompt.attachAndStartEditing(div); | |
| 14 prompt.setText("hey"); | |
| 15 UnitTest.addSniffer(prompt, "_completionsReady").then(step2); | |
| 16 prompt.complete(); | |
| 17 function step2() { | |
| 18 UnitTest.addResult("Text:" + prompt.text()); | |
| 19 UnitTest.addResult("TextWithCurrentSuggestion:" + prompt.textWithCurrent
Suggestion()); | |
| 20 | |
| 21 UnitTest.addResult("Test with inexact match:"); | |
| 22 prompt.clearAutocomplete(); | |
| 23 prompt.setText("inexactmatch"); | |
| 24 UnitTest.addSniffer(prompt, "_completionsReady").then(step3); | |
| 25 prompt.complete(); | |
| 26 } | |
| 27 function step3() { | |
| 28 UnitTest.addResult("Text:" + prompt.text()); | |
| 29 UnitTest.addResult("TextWithCurrentSuggestion:" + prompt.textWithCurrent
Suggestion()); | |
| 30 UnitTest.completeTest(); | |
| 31 } | |
| 32 } | |
| 33 </script> | |
| 34 </head> | |
| 35 <body> | |
| 36 This tests if the TextPrompt autocomplete works properly. | |
| 37 </body> | |
| 38 </html> | |
| OLD | NEW |