From 758860dbca005931b4c0d2c366e66a9672dccf85 Mon Sep 17 00:00:00 2001 From: Adam Gordon Date: Sun, 2 Aug 2015 14:58:44 -0600 Subject: [PATCH] chore(buttons): add missing unit test for `btn-radio` - added missing unit test to test for string literal values on btn-radio directive Closes #4083 --- src/buttons/test/buttons.spec.js | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/src/buttons/test/buttons.spec.js b/src/buttons/test/buttons.spec.js index 63555801a7..70b5513563 100644 --- a/src/buttons/test/buttons.spec.js +++ b/src/buttons/test/buttons.spec.js @@ -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('', $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 () {