| OLD | NEW |
| 1 TestRunner.loadLazyModules(["quick_open"]).then(test); | 1 TestRunner.loadLazyModules(["quick_open"]).then(test); |
| 2 function test() { | 2 function test() { |
| 3 TestRunner.addResult("Check to see that FilteredItemSelectionDialog uses pro
per regex to filter results."); | 3 TestRunner.addResult("Check to see that FilteredItemSelectionDialog uses pro
per regex to filter results."); |
| 4 | 4 |
| 5 var overridenInput = []; | 5 var overridenInput = []; |
| 6 var overrideShowMatchingItems = true; | |
| 7 var history = []; | 6 var history = []; |
| 8 | 7 |
| 9 var StubProvider = class extends QuickOpen.FilteredListWidget.Provider { | 8 var StubProvider = class extends QuickOpen.FilteredListWidget.Provider { |
| 10 itemKeyAt(itemIndex) { return overridenInput[itemIndex]; } | 9 itemKeyAt(itemIndex) { return overridenInput[itemIndex]; } |
| 11 itemScoreAt(itemIndex) { return 0; } | 10 itemScoreAt(itemIndex) { return 0; } |
| 12 itemCount() { return overridenInput.length; } | 11 itemCount() { return overridenInput.length; } |
| 13 selectItem(itemIndex, promptValue) | 12 selectItem(itemIndex, promptValue) |
| 14 { | 13 { |
| 15 TestRunner.addResult("Selected item index: " + itemIndex); | 14 TestRunner.addResult("Selected item index: " + itemIndex); |
| 16 } | 15 } |
| 17 shouldShowMatchingItems () { return overrideShowMatchingItems; } | |
| 18 }; | 16 }; |
| 19 | 17 |
| 20 var provider = new StubProvider(); | 18 var provider = new StubProvider(); |
| 21 | 19 |
| 22 function checkQuery(query, input, hideMatchingItems) | 20 function checkQuery(query, input) |
| 23 { | 21 { |
| 24 overridenInput = input; | 22 overridenInput = input; |
| 25 overrideShowMatchingItems = !hideMatchingItems; | |
| 26 | 23 |
| 27 TestRunner.addResult("Input:" + JSON.stringify(input)); | 24 TestRunner.addResult("Input:" + JSON.stringify(input)); |
| 28 | 25 |
| 29 var filteredSelectionDialog = new QuickOpen.FilteredListWidget(provider,
history); | 26 var filteredSelectionDialog = new QuickOpen.FilteredListWidget(provider,
history); |
| 30 filteredSelectionDialog.showAsDialog(); | 27 filteredSelectionDialog.showAsDialog(); |
| 31 var promise = TestRunner.addSniffer(filteredSelectionDialog, "_itemsFilt
eredForTest").then(accept); | 28 var promise = TestRunner.addSniffer(filteredSelectionDialog, "_itemsFilt
eredForTest").then(accept); |
| 32 filteredSelectionDialog.setQuery(query); | 29 filteredSelectionDialog.setQuery(query); |
| 33 filteredSelectionDialog._updateAfterItemsLoaded(); | 30 filteredSelectionDialog._updateAfterItemsLoaded(); |
| 34 return promise; | 31 return promise; |
| 35 | 32 |
| (...skipping 24 matching lines...) Expand all Loading... |
| 60 function caseSensitiveMatching() | 57 function caseSensitiveMatching() |
| 61 { | 58 { |
| 62 return checkQuery("aB", ["abc", "acB"]); | 59 return checkQuery("aB", ["abc", "acB"]); |
| 63 }, | 60 }, |
| 64 | 61 |
| 65 function caseInsensitiveMatching() | 62 function caseInsensitiveMatching() |
| 66 { | 63 { |
| 67 return checkQuery("ab", ["abc", "bac", "a_B"]); | 64 return checkQuery("ab", ["abc", "bac", "a_B"]); |
| 68 }, | 65 }, |
| 69 | 66 |
| 70 function dumplicateSymbolsInQuery(next) | 67 function dumplicateSymbolsInQuery() |
| 71 { | 68 { |
| 72 return checkQuery("aab", ["abab", "abaa", "caab", "baac", "fooaab"])
; | 69 return checkQuery("aab", ["abab", "abaa", "caab", "baac", "fooaab"])
; |
| 73 }, | 70 }, |
| 74 | 71 |
| 75 function dangerousInputEscaping(next) | 72 function dangerousInputEscaping() |
| 76 { | 73 { |
| 77 return checkQuery("^[]{}()\\.$*+?|", ["^[]{}()\\.$*+?|", "0123456789
abcdef"]); | 74 return checkQuery("^[]{}()\\.$*+?|", ["^[]{}()\\.$*+?|", "0123456789
abcdef"]); |
| 78 }, | 75 }, |
| 79 | 76 |
| 80 function itemIndexIsNotReportedInGoToLine(next) | 77 function itemIndexIsNotReportedInGoToLine() |
| 81 { | 78 { |
| 82 return checkQuery(":1", [":1:2:3.js"], true, next); | 79 return checkQuery(":1", []); |
| 83 }, | 80 }, |
| 84 | 81 |
| 85 function autoCompleteIsLast(next) | 82 function autoCompleteIsLast() |
| 86 { | 83 { |
| 87 return checkQuery("", ["abc", "abcd"]); | 84 return checkQuery("", ["abc", "abcd"]); |
| 88 } | 85 } |
| 89 ]); | 86 ]); |
| 90 } | 87 } |
| OLD | NEW |