diff --git a/src/typeahead/test/typeahead.spec.js b/src/typeahead/test/typeahead.spec.js index 1c374f40fe..8fa547c77a 100644 --- a/src/typeahead/test/typeahead.spec.js +++ b/src/typeahead/test/typeahead.spec.js @@ -416,6 +416,28 @@ describe('typeahead tests', function () { expect(element).toBeClosed(); }); + it('issue 1140 - should properly update loading callback when deleting characters', function () { + + $scope.items = function(viewValue) { + return $timeout(function(){ + return [viewValue]; + }); + }; + var element = prepareInputEl("
"); + var inputEl = findInput(element); + + changeInputValueTo(element, 'match'); + $scope.$digest(); + + expect($scope.isLoading).toBeTruthy(); + + changeInputValueTo(element, 'm'); + $timeout.flush(); + $scope.$digest(); + + expect($scope.isLoading).toBeFalsy(); + }); + it('does not close matches popup on click in input', function () { var element = prepareInputEl(""); var inputEl = findInput(element); diff --git a/src/typeahead/typeahead.js b/src/typeahead/typeahead.js index 97d67b646c..cc3ee79a82 100644 --- a/src/typeahead/typeahead.js +++ b/src/typeahead/typeahead.js @@ -160,6 +160,7 @@ angular.module('ui.bootstrap.typeahead', ['ui.bootstrap.position', 'ui.bootstrap getMatchesAsync(inputValue); } } else { + isLoadingSetter(originalScope, false); resetMatches(); }