diff options
Diffstat (limited to 'test')
| -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 22d3c84b..afb4e04f 100644 --- a/test/directivesSpec.js +++ b/test/directivesSpec.js @@ -220,6 +220,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.$eval(); + 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.$eval(); + 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>'); |
