Skip to content
This repository has been archived by the owner on May 29, 2019. It is now read-only.

Commit

Permalink
chore(buttons): add missing unit test for btn-radio
Browse files Browse the repository at this point in the history
- added missing unit test to test for string literal values on btn-radio directive

Closes #4083
  • Loading branch information
icfantv authored and Foxandxss committed Aug 2, 2015
1 parent 74a8be4 commit 758860d
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions src/buttons/test/buttons.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,25 @@ describe('buttons', function () {
expect(btns.eq(1)).not.toHaveClass('active');
});

it('should handle string values in btn-radio value', function () {
$scope.model = 'Two';
var btns = compileButtons('<button ng-model="model" btn-radio="\'One\'">click1</button><button ng-model="model" btn-radio="\'Two\'">click2</button>', $scope);

expect(btns.eq(0)).not.toHaveClass('active');
expect(btns.eq(1)).toHaveClass('active');

btns.eq(0).click();
expect(btns.eq(0)).toHaveClass('active');
expect(btns.eq(1)).not.toHaveClass('active');
expect($scope.model).toEqual('One');

$scope.$digest();

expect(btns.eq(0)).toHaveClass('active');
expect(btns.eq(1)).not.toHaveClass('active');
expect($scope.model).toEqual('One');
});

describe('uncheckable', function () {
//model -> UI
it('should set active class based on model', function () {
Expand Down

0 comments on commit 758860d

Please sign in to comment.