| 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 function testCompletions(base, prefix, expected) | 16 function testCompletions(base, prefix, expected) |
| 17 { | 17 { |
| 18 var callback; | 18 var callback; |
| 19 var promise = new Promise(fulfill => callback = fulfill); | 19 var promise = new Promise(fulfill => callback = fulfill); |
| 20 WebInspector.ExecutionContextSelector.completionsForTextInCurrentContext
(base, prefix).then(checkExpected); | 20 WebInspector.JavaScriptAutocomplete.completionsForTextInCurrentContext(b
ase, prefix).then(checkExpected); |
| 21 return promise; | 21 return promise; |
| 22 | 22 |
| 23 function checkExpected(completions) | 23 function checkExpected(completions) |
| 24 { | 24 { |
| 25 InspectorTest.addResult("Checking '" + base + prefix + "'"); | 25 InspectorTest.addResult("Checking '" + base + prefix + "'"); |
| 26 for (var i = 0; i < expected.length; i++) | 26 for (var i = 0; i < expected.length; i++) |
| 27 InspectorTest.addResult(((completions.indexOf(expected[i]) !== -
1) ? "Found" : "Not Found") + ": " + expected[i]); | 27 InspectorTest.addResult(((completions.indexOf(expected[i]) !== -
1) ? "Found" : "Not Found") + ": " + expected[i]); |
| 28 InspectorTest.addResult(""); | 28 InspectorTest.addResult(""); |
| 29 callback(); | 29 callback(); |
| 30 } | 30 } |
| (...skipping 18 matching lines...) Expand all Loading... |
| 49 () => testCompletions("templateString`asdf`", "should", ["shouldNotFindT
his"]) | 49 () => testCompletions("templateString`asdf`", "should", ["shouldNotFindT
his"]) |
| 50 ]).then(InspectorTest.completeTest); | 50 ]).then(InspectorTest.completeTest); |
| 51 | 51 |
| 52 } | 52 } |
| 53 </script> | 53 </script> |
| 54 </head> | 54 </head> |
| 55 <body onload="runTest()"> | 55 <body onload="runTest()"> |
| 56 <p>Tests that console correctly finds suggestions in complicated cases.</p> | 56 <p>Tests that console correctly finds suggestions in complicated cases.</p> |
| 57 </body> | 57 </body> |
| 58 </html> | 58 </html> |
| OLD | NEW |