@@ -568,6 +568,30 @@ describe('browser', function() {
568
568
expect ( replaceState ) . not . toHaveBeenCalled ( ) ;
569
569
expect ( locationReplace ) . not . toHaveBeenCalled ( ) ;
570
570
} ) ;
571
+
572
+ it ( 'should not do pushState with a URL only different in encoding' , function ( ) {
573
+ //A URL from something such as window.location.href
574
+ browser . url ( 'http://server/abc?q=%27' ) ;
575
+
576
+ pushState . calls . reset ( ) ;
577
+ replaceState . calls . reset ( ) ;
578
+ locationReplace . calls . reset ( ) ;
579
+
580
+ //A prettier URL from something such as $location
581
+ browser . url ( 'http://server/abc?q=\'' ) ;
582
+ expect ( pushState ) . not . toHaveBeenCalled ( ) ;
583
+ expect ( replaceState ) . not . toHaveBeenCalled ( ) ;
584
+ expect ( locationReplace ) . not . toHaveBeenCalled ( ) ;
585
+ } ) ;
586
+
587
+ it ( 'should not do pushState on $$checkUrlChange() with a URL only different in encoding' , function ( ) {
588
+ var callback = jasmine . createSpy ( 'onUrlChange' ) ;
589
+ browser . onUrlChange ( callback ) ;
590
+ browser . url ( 'http://server/abc?q=\'' ) ;
591
+
592
+ browser . $$checkUrlChange ( ) ;
593
+ expect ( callback ) . not . toHaveBeenCalled ( ) ;
594
+ } ) ;
571
595
} ;
572
596
}
573
597
} ) ;
@@ -1014,7 +1038,7 @@ describe('browser', function() {
1014
1038
it ( 'should not interfere with legacy browser url replace behavior' , function ( ) {
1015
1039
inject ( function ( $rootScope ) {
1016
1040
var current = fakeWindow . location . href ;
1017
- var newUrl = 'notyet' ;
1041
+ var newUrl = 'http:// notyet' ;
1018
1042
sniffer . history = false ;
1019
1043
expect ( historyEntriesLength ) . toBe ( 1 ) ;
1020
1044
browser . url ( newUrl , true ) ;
0 commit comments