@@ -690,6 +690,64 @@ describe('browser', function() {
690
690
expect ( locationReplace ) . not . toHaveBeenCalled ( ) ;
691
691
} ) ;
692
692
693
+ it ( 'should not detect changes on $$checkUrlChange() due to input vs actual encoding' , function ( ) {
694
+ var callback = jasmine . createSpy ( 'onUrlChange' ) ;
695
+ browser . onUrlChange ( callback ) ;
696
+
697
+ browser . url ( 'http://server/-._~!$&\'()*+,;=:@/abc?q=-._~!$\'()*+,;:@/?"#-._~!$&\'()*+,;=:@' ) ;
698
+ browser . $$checkUrlChange ( ) ;
699
+ expect ( callback ) . not . toHaveBeenCalled ( ) ;
700
+
701
+ browser . url ( 'http://server/%2D%2E%5F%7E%21%24%26%27%28%29%2A%2B%2C%3B%3D%3A%40/abc?q=%2D%2E%5F%7E%21%24%27%28%29%2A%2B%2C%3B%3A%40%2F%3F%22#%2D%2E%5F%7E%21%24%26%27%28%29%2A%2B%2C%3B%3D%3A%40' ) ;
702
+ browser . $$checkUrlChange ( ) ;
703
+ expect ( callback ) . not . toHaveBeenCalled ( ) ;
704
+ } ) ;
705
+
706
+ it ( 'should not do pushState with a URL only different in encoding (less)' , function ( ) {
707
+ // A URL from something such as window.location.href
708
+ browser . url ( 'http://server/%2D%2E%5F%7E%21%24%26%27%28%29%2A%2B%2C%3B%3D%3A%40/abc?q=%2D%2E%5F%7E%21%24%27%28%29%2A%2B%2C%3B%3A%40%2F%3F%22#%2D%2E%5F%7E%21%24%26%27%28%29%2A%2B%2C%3B%3D%3A%40' ) ;
709
+
710
+ pushState . calls . reset ( ) ;
711
+ replaceState . calls . reset ( ) ;
712
+ locationReplace . calls . reset ( ) ;
713
+
714
+ // A prettier URL from something such as $location
715
+ browser . url ( 'http://server/-._~!$&\'()*+,;=:@/abc?q=-._~!$\'()*+,;:@/?"#-._~!$&\'()*+,;=:@' ) ;
716
+ expect ( pushState ) . not . toHaveBeenCalled ( ) ;
717
+ expect ( replaceState ) . not . toHaveBeenCalled ( ) ;
718
+ expect ( locationReplace ) . not . toHaveBeenCalled ( ) ;
719
+ } ) ;
720
+
721
+ it ( 'should not do pushState with a URL only different in encoding (more)' , function ( ) {
722
+ // A prettier URL from something such as $location
723
+ browser . url ( 'http://server/-._~!$&\'()*+,;=:@/abc?q=-._~!$\'()*+,;:@/?"#-._~!$&\'()*+,;=:@' ) ;
724
+
725
+ pushState . calls . reset ( ) ;
726
+ replaceState . calls . reset ( ) ;
727
+ locationReplace . calls . reset ( ) ;
728
+
729
+ // A URL from something such as window.location.href
730
+ browser . url ( 'http://server/%2D%2E%5F%7E%21%24%26%27%28%29%2A%2B%2C%3B%3D%3A%40/abc?q=%2D%2E%5F%7E%21%24%27%28%29%2A%2B%2C%3B%3A%40%2F%3F%22#%2D%2E%5F%7E%21%24%26%27%28%29%2A%2B%2C%3B%3D%3A%40' ) ;
731
+ expect ( pushState ) . not . toHaveBeenCalled ( ) ;
732
+ expect ( replaceState ) . not . toHaveBeenCalled ( ) ;
733
+ expect ( locationReplace ) . not . toHaveBeenCalled ( ) ;
734
+ } ) ;
735
+
736
+ it ( 'should not do pushState with a URL only different in encoding case' , function ( ) {
737
+ // A prettier URL from something such as $location
738
+ browser . url ( 'http://server/%2D%2E%5F%7E%21%24%26%27%28%29%2A%2B%2C%3B%3D%3A%40/abc?q=%2D%2E%5F%7E%21%24%27%28%29%2A%2B%2C%3B%3A%40%2F%3F%22' ) ;
739
+
740
+ pushState . calls . reset ( ) ;
741
+ replaceState . calls . reset ( ) ;
742
+ locationReplace . calls . reset ( ) ;
743
+
744
+ // A URL from something such as window.location.href
745
+ browser . url ( 'http://server/%2d%2e%5f%7e%21%24%26%27%28%29%2a%2b%2c%3b%3d%3a%40/abc?q=%2D%2E%5F%7E%21%24%27%28%29%2A%2B%2C%3B%3A%40%2F%3F%22' ) ;
746
+ expect ( pushState ) . not . toHaveBeenCalled ( ) ;
747
+ expect ( replaceState ) . not . toHaveBeenCalled ( ) ;
748
+ expect ( locationReplace ) . not . toHaveBeenCalled ( ) ;
749
+ } ) ;
750
+
693
751
it ( 'should not do pushState with a URL only adding a trailing slash after domain' , function ( ) {
694
752
// A domain without a trailing /
695
753
browser . url ( 'http://server' ) ;
0 commit comments