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