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