@@ -1001,8 +1001,76 @@ describe('browser', function() {
1001
1001
} ) ;
1002
1002
} ) ;
1003
1003
1004
+
1005
+ it ( 'should work with apostrophes in url with no history support, no html5Mode' , function ( ) {
1006
+ setup ( {
1007
+ history : false ,
1008
+ html5Mode : false
1009
+ } ) ;
1010
+
1011
+ inject ( function ( $rootScope , $location ) {
1012
+ /* all aphostrofes in url should be replaced */
1013
+ fakeWindow . location . href = 'http://server/#!/param1=data%27s1¶m2=data%27s2' ;
1014
+ $rootScope . $digest ( ) ;
1015
+ expect ( $location . path ( ) ) . toBe ( '/param1=data\'s1¶m2=data\'s2' ) ;
1016
+
1017
+ /* validate that location.href could be updated */
1018
+ fakeWindow . location . href = 'http://server/#!/data1=anotherValue%27s1&data2=anotherValue%27s2' ;
1019
+ $rootScope . $digest ( ) ;
1020
+ expect ( $location . path ( ) ) . toBe ( '/data1=anotherValue\'s1&data2=anotherValue\'s2' ) ;
1021
+ } ) ;
1022
+ } ) ;
1023
+
1024
+ it ( 'should work with apostrophes in url with html5Mode and no history support' , function ( ) {
1025
+ setup ( {
1026
+ history : false ,
1027
+ html5Mode : true
1028
+ } ) ;
1029
+
1030
+ inject ( function ( $rootScope , $location ) {
1031
+
1032
+ fakeWindow . location . href = 'http://server/#!/param1=data%27s1¶m2=data%27s2' ;
1033
+ $rootScope . $digest ( ) ;
1034
+ expect ( $location . path ( ) ) . toBe ( '/param1=data\'s1¶m2=data\'s2' ) ;
1035
+
1036
+ fakeWindow . location . href = 'http://server/#!/data1=anotherValue%27s1&data2=anotherValue%27s2' ;
1037
+ $rootScope . $digest ( ) ;
1038
+ expect ( $location . path ( ) ) . toBe ( '/data1=anotherValue\'s1&data2=anotherValue\'s2' ) ;
1039
+ } ) ;
1040
+ } ) ;
1041
+
1042
+ it ( 'should work with apostrophes in url with history and no html5' , function ( ) {
1043
+ setup ( {
1044
+ history : true ,
1045
+ html5Mode : false
1046
+ } ) ;
1047
+ inject ( function ( $rootScope , $location ) {
1048
+ fakeWindow . location . href = 'http://server/#!/param1=data%27s1¶m2=data%27s2' ;
1049
+ $rootScope . $digest ( ) ;
1050
+ expect ( $location . path ( ) ) . toBe ( '/param1=data\'s1¶m2=data\'s2' ) ;
1051
+ fakeWindow . location . href = 'http://server/#!/data1=anotherValue%27s1&data2=anotherValue%27s2' ;
1052
+ $rootScope . $digest ( ) ;
1053
+ expect ( $location . path ( ) ) . toBe ( '/data1=anotherValue\'s1&data2=anotherValue\'s2' ) ;
1054
+ } ) ;
1055
+ } ) ;
1056
+
1057
+ it ( 'should work with apostrophes in url with history and html5' , function ( ) {
1058
+ setup ( {
1059
+ history : true ,
1060
+ html5Mode : true
1061
+ } ) ;
1062
+ inject ( function ( $rootScope , $location ) {
1063
+ fakeWindow . location . href = 'http://server/param1=data%27s1¶m2=data%27s2' ;
1064
+ $rootScope . $digest ( ) ;
1065
+ expect ( $location . path ( ) ) . toBe ( '/param1=data\'s1¶m2=data\'s2' ) ;
1066
+ fakeWindow . location . href = 'http://server/data1=anotherValue%27s1&data2=anotherValue%27s2' ;
1067
+ $rootScope . $digest ( ) ;
1068
+ expect ( $location . path ( ) ) . toBe ( '/data1=anotherValue\'s1&data2=anotherValue\'s2' ) ;
1069
+ } ) ;
1070
+ } ) ;
1004
1071
} ) ;
1005
1072
1073
+
1006
1074
it ( 'should not reload the page on every $digest when the page will be reloaded due to url rewrite on load' , function ( ) {
1007
1075
setup ( {
1008
1076
history : false ,
0 commit comments