@@ -97,7 +97,7 @@ describe('uiStateRef', function() {
97
97
}
98
98
} ;
99
99
100
- describe ( 'links' , function ( ) {
100
+ xdescribe ( 'links' , function ( ) {
101
101
beforeEach ( inject ( buildDOM ) ) ;
102
102
103
103
it ( 'should generate the correct href' , function ( ) {
@@ -490,6 +490,9 @@ describe('uiSrefActive', function() {
490
490
template : '<ui-view/>'
491
491
} ) . state ( 'admin.roles' , {
492
492
url : '/roles?page'
493
+ } ) . state ( 'arrayparam' , {
494
+ url : '/arrayparam?{foo:int}&bar' ,
495
+ template : '<div></div>'
493
496
} ) ;
494
497
} ) ) ;
495
498
@@ -539,6 +542,30 @@ describe('uiSrefActive', function() {
539
542
expect ( angular . element ( template [ 0 ] . querySelector ( 'a' ) ) . attr ( 'class' ) ) . toBe ( '' ) ;
540
543
} ) ) ;
541
544
545
+ // Test for #2696
546
+ it ( 'should compare using typed parameters' , inject ( function ( $rootScope , $q , $compile , $state ) {
547
+ el = angular . element ( '<div><a ui-sref="arrayparam({ foo: [1,2,3] })" ui-sref-active="active">foo 123</a></div>' ) ;
548
+ template = $compile ( el ) ( $rootScope ) ;
549
+ $rootScope . $digest ( ) ;
550
+
551
+ expect ( angular . element ( template [ 0 ] . querySelector ( 'a' ) ) . attr ( 'class' ) ) . toBe ( '' ) ;
552
+
553
+ $state . transitionTo ( 'arrayparam' , { foo : [ 1 , 2 , 3 ] } ) ;
554
+ $q . flush ( ) ;
555
+ timeoutFlush ( ) ;
556
+ expect ( angular . element ( template [ 0 ] . querySelector ( 'a' ) ) . attr ( 'class' ) ) . toBe ( 'active' ) ;
557
+
558
+ $state . transitionTo ( 'arrayparam' , { foo : [ 1 , 2 , 3 ] , bar : 'asdf' } ) ;
559
+ $q . flush ( ) ;
560
+ timeoutFlush ( ) ;
561
+ expect ( angular . element ( template [ 0 ] . querySelector ( 'a' ) ) . attr ( 'class' ) ) . toBe ( 'active' ) ;
562
+
563
+ $state . transitionTo ( 'arrayparam' , { foo : [ 1 , 2 ] } ) ;
564
+ $q . flush ( ) ;
565
+ timeoutFlush ( ) ;
566
+ expect ( angular . element ( template [ 0 ] . querySelector ( 'a' ) ) . attr ( 'class' ) ) . toBe ( '' ) ;
567
+ } ) ) ;
568
+
542
569
it ( 'should update in response to ui-sref param expression changes' , inject ( function ( $rootScope , $q , $compile , $state ) {
543
570
el = angular . element ( '<div><a ui-sref="contacts.item.detail({ foo: fooId })" ui-sref-active="active">Contacts</a></div>' ) ;
544
571
template = $compile ( el ) ( $rootScope ) ;
0 commit comments