| OLD | NEW |
| 1 <html> | 1 <html> |
| 2 <head> | 2 <head> |
| 3 <script src="../../http/tests/inspector/inspector-test.js"></script> | 3 <script src="../../http/tests/inspector/inspector-test.js"></script> |
| 4 <script src="../../http/tests/inspector/console-test.js"></script> | 4 <script src="../../http/tests/inspector/console-test.js"></script> |
| 5 <script> | 5 <script> |
| 6 function templateString() | 6 function templateString() |
| 7 { | 7 { |
| 8 console.log("The template string should not run and you should not see this
log"); | 8 console.log("The template string should not run and you should not see this
log"); |
| 9 return { | 9 return { |
| 10 shouldNotFindThis:56 | 10 shouldNotFindThis:56 |
| 11 }; | 11 }; |
| 12 } | 12 } |
| 13 | 13 |
| 14 function test() | 14 function test() |
| 15 { | 15 { |
| 16 var consoleEditor; | 16 var consoleEditor; |
| 17 function testCompletions(text, expected, force) | 17 function testCompletions(text, expected, force) |
| 18 { | 18 { |
| 19 consoleEditor.setText(text); | 19 consoleEditor.setText(text); |
| 20 consoleEditor.setSelection(WebInspector.TextRange.createFromLocation(Inf
inity, Infinity)); | 20 consoleEditor.setSelection(Common.TextRange.createFromLocation(Infinity,
Infinity)); |
| 21 consoleEditor._autocompleteController.autocomplete(force); | 21 consoleEditor._autocompleteController.autocomplete(force); |
| 22 return InspectorTest.addSnifferPromise(consoleEditor._autocompleteContro
ller, "_onSuggestionsShownForTest").then(checkExpected); | 22 return InspectorTest.addSnifferPromise(consoleEditor._autocompleteContro
ller, "_onSuggestionsShownForTest").then(checkExpected); |
| 23 | 23 |
| 24 function checkExpected(suggestions) | 24 function checkExpected(suggestions) |
| 25 { | 25 { |
| 26 var completions = new Set(suggestions.map(suggestion => suggestion.t
itle)); | 26 var completions = new Set(suggestions.map(suggestion => suggestion.t
itle)); |
| 27 var message = "Checking '" + text + "'"; | 27 var message = "Checking '" + text + "'"; |
| 28 if (force) | 28 if (force) |
| 29 message += " forcefully"; | 29 message += " forcefully"; |
| 30 InspectorTest.addResult(message); | 30 InspectorTest.addResult(message); |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 65 () => testCompletions("// do", ["document"], false) | 65 () => testCompletions("// do", ["document"], false) |
| 66 ]).then(InspectorTest.completeTest); | 66 ]).then(InspectorTest.completeTest); |
| 67 | 67 |
| 68 } | 68 } |
| 69 </script> | 69 </script> |
| 70 </head> | 70 </head> |
| 71 <body onload="runTest()"> | 71 <body onload="runTest()"> |
| 72 <p>Tests that console correctly finds suggestions in complicated cases.</p> | 72 <p>Tests that console correctly finds suggestions in complicated cases.</p> |
| 73 </body> | 73 </body> |
| 74 </html> | 74 </html> |
| OLD | NEW |