| OLD | NEW |
| 1 function initialize_AutocompleteTest() | 1 function initialize_AutocompleteTest() |
| 2 { | 2 { |
| 3 | 3 |
| 4 InspectorTest.dumpSuggestions = function(textEditor, lines) | 4 InspectorTest.dumpSuggestions = function(textEditor, lines) |
| 5 { | 5 { |
| 6 var resolve; | 6 var resolve; |
| 7 var promise = new Promise(fulfill => resolve = fulfill); | 7 var promise = new Promise(fulfill => resolve = fulfill); |
| 8 var lineNumber = -1, columnNumber; | 8 var lineNumber = -1, columnNumber; |
| 9 for (var i = 0; i < lines.length; ++i) { | 9 for (var i = 0; i < lines.length; ++i) { |
| 10 var columnNumber = lines[i].indexOf("|"); | 10 var columnNumber = lines[i].indexOf("|"); |
| 11 if (columnNumber !== -1) { | 11 if (columnNumber !== -1) { |
| 12 lineNumber = i; | 12 lineNumber = i; |
| 13 break; | 13 break; |
| 14 } | 14 } |
| 15 } | 15 } |
| 16 if (lineNumber === -1) | 16 if (lineNumber === -1) |
| 17 throw new Error("Test case is invalid: cursor position is not marked
with '|' symbol."); | 17 throw new Error("Test case is invalid: cursor position is not marked
with '|' symbol."); |
| 18 textEditor.setText(lines.join("\n").replace("|", "")); | 18 textEditor.setText(lines.join("\n").replace("|", "")); |
| 19 textEditor.setSelection(WebInspector.TextRange.createFromLocation(lineNu
mber, columnNumber)); | 19 textEditor.setSelection(Common.TextRange.createFromLocation(lineNumber,
columnNumber)); |
| 20 InspectorTest.addSniffer(WebInspector.TextEditorAutocompleteController.p
rototype, "_onSuggestionsShownForTest", suggestionsShown); | 20 InspectorTest.addSniffer(TextEditor.TextEditorAutocompleteController.pro
totype, "_onSuggestionsShownForTest", suggestionsShown); |
| 21 textEditor._autocompleteController.autocomplete(); | 21 textEditor._autocompleteController.autocomplete(); |
| 22 function suggestionsShown(words) | 22 function suggestionsShown(words) |
| 23 { | 23 { |
| 24 InspectorTest.addResult("========= Selection In Editor ========="); | 24 InspectorTest.addResult("========= Selection In Editor ========="); |
| 25 InspectorTest.dumpTextWithSelection(textEditor); | 25 InspectorTest.dumpTextWithSelection(textEditor); |
| 26 InspectorTest.addResult("======= Autocomplete Suggestions ======="); | 26 InspectorTest.addResult("======= Autocomplete Suggestions ======="); |
| 27 InspectorTest.addResult("[" + words.map(item => item.title).join(",
") + "]"); | 27 InspectorTest.addResult("[" + words.map(item => item.title).join(",
") + "]"); |
| 28 resolve(); | 28 resolve(); |
| 29 } | 29 } |
| 30 return promise; | 30 return promise; |
| 31 } | 31 } |
| 32 | 32 |
| 33 } | 33 } |
| OLD | NEW |