diff --git a/src/tags-input.js b/src/tags-input.js index 3542ed4c..c27cd6a8 100644 --- a/src/tags-input.js +++ b/src/tags-input.js @@ -280,19 +280,14 @@ tagsInput.directive('tagsInput', function($timeout, $document, tagsInputConfig) }) .on('input-focus', function() { element.triggerHandler('focus'); - ngModelCtrl.$setValidity('leftoverText', true); }) .on('input-blur', function() { - element.triggerHandler('blur'); - - if (!options.addFromAutocompleteOnly) { - if (options.addOnBlur) { - tagList.addText(scope.newTag.text); - } - - setElementValidity(); + if (options.addOnBlur && !options.addFromAutocompleteOnly) { + tagList.addText(scope.newTag.text); } + element.triggerHandler('blur'); + setElementValidity(); }) .on('input-keydown', function(event) { var key = event.keyCode, diff --git a/test/tags-input.spec.js b/test/tags-input.spec.js index 7d5563ca..2025cebc 100644 --- a/test/tags-input.spec.js +++ b/test/tags-input.spec.js @@ -1287,18 +1287,6 @@ describe('tags-input directive', function() { // Assert expect(isolateScope.tags).toEqual([]); }); - - it('does not make the element invalid when it loses focus and there is any leftover text', function() { - // Arrange - isolateScope.newTag.text = 'foo'; - - // Act - isolateScope.events.trigger('input-blur'); - - // Assert - expect($scope.form.tags.$valid).toBe(true); - expect($scope.form.tags.$error.leftoverText).toBeFalsy(); - }); }); });