You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on May 29, 2019. It is now read-only.
Copy file name to clipboardexpand all lines: src/typeahead/test/typeahead.spec.js
+35
Original file line number
Diff line number
Diff line change
@@ -183,6 +183,41 @@ describe('typeahead tests', function () {
183
183
$timeout.flush();
184
184
expect(element).toBeOpenWithActive(1,0);
185
185
}));
186
+
187
+
it('should cancel old timeouts when something is typed within waitTime',inject(function($timeout){
188
+
varvalues=[];
189
+
$scope.loadMatches=function(viewValue){
190
+
values.push(viewValue);
191
+
return$scope.source;
192
+
};
193
+
varelement=prepareInputEl("<div><input ng-model='result' typeahead='item for item in loadMatches($viewValue) | filter:$viewValue' typeahead-wait-ms='200'></div>");
194
+
changeInputValueTo(element,'first');
195
+
changeInputValueTo(element,'second');
196
+
197
+
$timeout.flush();
198
+
199
+
expect(values).not.toContain('first');
200
+
}));
201
+
202
+
it('should allow timeouts when something is typed after waitTime has passed',inject(function($timeout){
203
+
varvalues=[];
204
+
205
+
$scope.loadMatches=function(viewValue){
206
+
values.push(viewValue);
207
+
return$scope.source;
208
+
};
209
+
varelement=prepareInputEl("<div><input ng-model='result' typeahead='item for item in loadMatches($viewValue) | filter:$viewValue' typeahead-wait-ms='200'></div>");
0 commit comments