@@ -391,7 +391,7 @@ describe('$compile', function() {
391
391
} ) ) ;
392
392
393
393
394
- it ( 'should merge attributes' , inject ( function ( $compile , $rootScope ) {
394
+ it ( 'should merge attributes including style attr ' , inject ( function ( $compile , $rootScope ) {
395
395
element = $compile (
396
396
'<div><div replace class="medium-log" style="height: 20px" ></div><div>' )
397
397
( $rootScope ) ;
@@ -431,6 +431,39 @@ describe('$compile', function() {
431
431
$rootScope . $digest ( ) ;
432
432
expect ( element . text ( ) ) . toEqual ( 'Hello: 1; Hello: 2; ' ) ;
433
433
} ) ) ;
434
+
435
+
436
+ it ( 'should merge interpolated css class' , inject ( function ( $compile , $rootScope ) {
437
+ element = $compile ( '<div class="one {{cls}} three" replace></div>' ) ( $rootScope ) ;
438
+
439
+ $rootScope . $apply ( function ( ) {
440
+ $rootScope . cls = 'two' ;
441
+ } ) ;
442
+
443
+ expect ( element ) . toHaveClass ( 'one' ) ;
444
+ expect ( element ) . toHaveClass ( 'two' ) ; // interpolated
445
+ expect ( element ) . toHaveClass ( 'three' ) ;
446
+ expect ( element ) . toHaveClass ( 'log' ) ; // merged from replace directive template
447
+ } ) ) ;
448
+
449
+
450
+ it ( 'should merge interpolated css class with ng-repeat' ,
451
+ inject ( function ( $compile , $rootScope ) {
452
+ element = $compile (
453
+ '<div>' +
454
+ '<div ng-repeat="i in [1]" class="one {{cls}} three" replace></div>' +
455
+ '</div>' ) ( $rootScope ) ;
456
+
457
+ $rootScope . $apply ( function ( ) {
458
+ $rootScope . cls = 'two' ;
459
+ } ) ;
460
+
461
+ var child = element . find ( 'div' ) . eq ( 0 ) ;
462
+ expect ( child ) . toHaveClass ( 'one' ) ;
463
+ expect ( child ) . toHaveClass ( 'two' ) ; // interpolated
464
+ expect ( child ) . toHaveClass ( 'three' ) ;
465
+ expect ( child ) . toHaveClass ( 'log' ) ; // merged from replace directive template
466
+ } ) ) ;
434
467
} ) ;
435
468
436
469
0 commit comments