diff options
| author | Di Peng | 2011-08-09 18:24:56 -0700 |
|---|---|---|
| committer | Igor Minar | 2011-08-14 22:46:51 -0700 |
| commit | 7ec8a89362f7010f2b0f5fb73a644dab789ce010 (patch) | |
| tree | 4468c1d720ef1f0b205d93250d3c8bdfdb4a5904 /test/directivesSpec.js | |
| parent | 34f174066f1aa70dba0f97942580082169348200 (diff) | |
| download | angular.js-7ec8a89362f7010f2b0f5fb73a644dab789ce010.tar.bz2 | |
fix(directives): make ng:class-even/odd work with ng:class
Closes #508
Diffstat (limited to 'test/directivesSpec.js')
| -rw-r--r-- | test/directivesSpec.js | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/test/directivesSpec.js b/test/directivesSpec.js index 1a02e318..488ebaa2 100644 --- a/test/directivesSpec.js +++ b/test/directivesSpec.js @@ -217,6 +217,50 @@ describe("directive", function(){ expect(e2.hasClass('even')).toBeTruthy(); }); + + it('should allow both ng:class and ng:class-odd/even on the same element', function() { + var scope = compile('<ul>' + + '<li ng:repeat="i in [0,1]" ng:class="\'plainClass\'" ' + + 'ng:class-odd="\'odd\'" ng:class-even="\'even\'"></li>' + + '<ul>'); + scope.$apply(); + var e1 = jqLite(element[0].childNodes[1]); + var e2 = jqLite(element[0].childNodes[2]); + + expect(e1.hasClass('plainClass')).toBeTruthy(); + expect(e1.hasClass('odd')).toBeTruthy(); + expect(e1.hasClass('even')).toBeFalsy(); + expect(e2.hasClass('plainClass')).toBeTruthy(); + expect(e2.hasClass('even')).toBeTruthy(); + expect(e2.hasClass('odd')).toBeFalsy(); + }); + + + it('should allow both ng:class and ng:class-odd/even with multiple classes', function() { + var scope = compile('<ul>' + + '<li ng:repeat="i in [0,1]" ng:class="[\'A\', \'B\']" ' + + 'ng:class-odd="[\'C\', \'D\']" ng:class-even="[\'E\', \'F\']"></li>' + + '<ul>'); + scope.$apply(); + var e1 = jqLite(element[0].childNodes[1]); + var e2 = jqLite(element[0].childNodes[2]); + + expect(e1.hasClass('A')).toBeTruthy(); + expect(e1.hasClass('B')).toBeTruthy(); + expect(e1.hasClass('C')).toBeTruthy(); + expect(e1.hasClass('D')).toBeTruthy(); + expect(e1.hasClass('E')).toBeFalsy(); + expect(e1.hasClass('F')).toBeFalsy(); + + expect(e2.hasClass('A')).toBeTruthy(); + expect(e2.hasClass('B')).toBeTruthy(); + expect(e2.hasClass('E')).toBeTruthy(); + expect(e2.hasClass('F')).toBeTruthy(); + expect(e2.hasClass('C')).toBeFalsy(); + expect(e2.hasClass('D')).toBeFalsy(); + }); + + describe('ng:style', function(){ it('should set', function(){ var scope = compile('<div ng:style="{height: \'40px\'}"></div>'); |
