Skip to content
This repository has been archived by the owner on Nov 22, 2021. It is now read-only.

Commit

Permalink
Add more unittests
Browse files Browse the repository at this point in the history
  • Loading branch information
Chad Gatesman committed Nov 27, 2018
1 parent 98e8fdb commit 28dd1c5
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions test/tags-input.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -1991,6 +1991,34 @@ describe('tags-input directive', () => {
expect($scope.callback).toHaveBeenCalledWith('foo');
});
});

it('calls the provided callback when a tag is removed by clicking the remove button', () => {
// Arrange
$scope.callback = jasmine.createSpy();
compile('use-strings="true" on-tag-removed="callback($tag)"');

// Act
getRemoveButton(0).click();

// Assert
$timeout(function() {
expect($scope.callback).toHaveBeenCalledWith('Tag1');
});
});

it('calls the provided callback when a tag is clicked', () => {
// Arrange
$scope.callback = jasmine.createSpy();
compile('use-strings="true" on-tag-clicked="callback($tag)"');

// Act
getTag(1).click();

// Assert
$timeout(function() {
expect($scope.callback).toHaveBeenCalledWith('Tag2');
});
});
});

describe('ng-disabled support', () => {
Expand Down

0 comments on commit 28dd1c5

Please sign in to comment.