@@ -220,6 +220,50 @@ describe("directive", function(){
220
220
expect ( e2 . hasClass ( 'even' ) ) . toBeTruthy ( ) ;
221
221
} ) ;
222
222
223
+
224
+ it ( 'should allow both ng:class and ng:class-odd/even on the same element' , function ( ) {
225
+ var scope = compile ( '<ul>' +
226
+ '<li ng:repeat="i in [0,1]" ng:class="\'plainClass\'" ' +
227
+ 'ng:class-odd="\'odd\'" ng:class-even="\'even\'"></li>' +
228
+ '<ul>' ) ;
229
+ scope . $eval ( ) ;
230
+ var e1 = jqLite ( element [ 0 ] . childNodes [ 1 ] ) ;
231
+ var e2 = jqLite ( element [ 0 ] . childNodes [ 2 ] ) ;
232
+
233
+ expect ( e1 . hasClass ( 'plainClass' ) ) . toBeTruthy ( ) ;
234
+ expect ( e1 . hasClass ( 'odd' ) ) . toBeTruthy ( ) ;
235
+ expect ( e1 . hasClass ( 'even' ) ) . toBeFalsy ( ) ;
236
+ expect ( e2 . hasClass ( 'plainClass' ) ) . toBeTruthy ( ) ;
237
+ expect ( e2 . hasClass ( 'even' ) ) . toBeTruthy ( ) ;
238
+ expect ( e2 . hasClass ( 'odd' ) ) . toBeFalsy ( ) ;
239
+ } ) ;
240
+
241
+
242
+ it ( 'should allow both ng:class and ng:class-odd/even with multiple classes' , function ( ) {
243
+ var scope = compile ( '<ul>' +
244
+ '<li ng:repeat="i in [0,1]" ng:class="[\'A\', \'B\']" ' +
245
+ 'ng:class-odd="[\'C\', \'D\']" ng:class-even="[\'E\', \'F\']"></li>' +
246
+ '<ul>' ) ;
247
+ scope . $eval ( ) ;
248
+ var e1 = jqLite ( element [ 0 ] . childNodes [ 1 ] ) ;
249
+ var e2 = jqLite ( element [ 0 ] . childNodes [ 2 ] ) ;
250
+
251
+ expect ( e1 . hasClass ( 'A' ) ) . toBeTruthy ( ) ;
252
+ expect ( e1 . hasClass ( 'B' ) ) . toBeTruthy ( ) ;
253
+ expect ( e1 . hasClass ( 'C' ) ) . toBeTruthy ( ) ;
254
+ expect ( e1 . hasClass ( 'D' ) ) . toBeTruthy ( ) ;
255
+ expect ( e1 . hasClass ( 'E' ) ) . toBeFalsy ( ) ;
256
+ expect ( e1 . hasClass ( 'F' ) ) . toBeFalsy ( ) ;
257
+
258
+ expect ( e2 . hasClass ( 'A' ) ) . toBeTruthy ( ) ;
259
+ expect ( e2 . hasClass ( 'B' ) ) . toBeTruthy ( ) ;
260
+ expect ( e2 . hasClass ( 'E' ) ) . toBeTruthy ( ) ;
261
+ expect ( e2 . hasClass ( 'F' ) ) . toBeTruthy ( ) ;
262
+ expect ( e2 . hasClass ( 'C' ) ) . toBeFalsy ( ) ;
263
+ expect ( e2 . hasClass ( 'D' ) ) . toBeFalsy ( ) ;
264
+ } ) ;
265
+
266
+
223
267
describe ( 'ng:style' , function ( ) {
224
268
it ( 'should set' , function ( ) {
225
269
var scope = compile ( '<div ng:style="{height: \'40px\'}"></div>' ) ;
0 commit comments