@@ -879,14 +879,10 @@ describe('$location', function() {
879
879
return function ( $browser ) {
880
880
if ( atRoot ) {
881
881
$browser . url ( 'http://host.com/' ) ;
882
- if ( ! noBase ) {
883
- $browser . $$baseHref = '/index.html' ;
884
- }
882
+ $browser . $$baseHref = noBase ? '' : '/index.html' ;
885
883
} else {
886
884
$browser . url ( 'http://host.com/base' ) ;
887
- if ( ! noBase ) {
888
- $browser . $$baseHref = '/base/index.html' ;
889
- }
885
+ $browser . $$baseHref = noBase ? '' : '/base/index.html' ;
890
886
}
891
887
} ;
892
888
}
@@ -1201,15 +1197,30 @@ describe('$location', function() {
1201
1197
} ) ;
1202
1198
1203
1199
1204
- it ( 'should rewrite relative links relative to current path when history disabled' , function ( ) {
1200
+ it ( 'should rewrite relative links relative to current path when no base and history enabled on old browser' , function ( ) {
1201
+ configureService ( 'link' , true , false , true ) ;
1202
+ inject (
1203
+ initBrowser ( false , true ) ,
1204
+ initLocation ( ) ,
1205
+ function ( $browser , $location ) {
1206
+ $location . path ( '/some' ) ;
1207
+ expect ( $browser . url ( ) , 'http://host.com/#!/some' ) ;
1208
+ browserTrigger ( link , 'click' ) ;
1209
+ expectRewriteTo ( $browser , 'http://host.com/#!/some/link' ) ;
1210
+ }
1211
+ ) ;
1212
+ } ) ;
1213
+
1214
+
1215
+ it ( 'should rewrite relative links relative to base href when history enabled on old browser' , function ( ) {
1205
1216
configureService ( 'link' , true , false , true ) ;
1206
1217
inject (
1207
1218
initBrowser ( ) ,
1208
1219
initLocation ( ) ,
1209
1220
function ( $browser , $location ) {
1210
1221
$location . path ( '/some' ) ;
1211
1222
browserTrigger ( link , 'click' ) ;
1212
- expectRewriteTo ( $browser , 'http://host.com/base/index.html#!/some/ link' ) ;
1223
+ expectRewriteTo ( $browser , 'http://host.com/base/index.html#!/link' ) ;
1213
1224
}
1214
1225
) ;
1215
1226
} ) ;
@@ -1243,6 +1254,20 @@ describe('$location', function() {
1243
1254
} ) ;
1244
1255
1245
1256
1257
+ it ( 'should rewrite relative hashbang links when history enabled on old browser' , function ( ) {
1258
+ configureService ( '#!link' , true , false , true ) ;
1259
+ inject (
1260
+ initBrowser ( ) ,
1261
+ initLocation ( ) ,
1262
+ function ( $browser , $location ) {
1263
+ $location . path ( '/some' ) ;
1264
+ browserTrigger ( link , 'click' ) ;
1265
+ expectRewriteTo ( $browser , 'http://host.com/base/index.html#!/some/link' ) ;
1266
+ }
1267
+ ) ;
1268
+ } ) ;
1269
+
1270
+
1246
1271
it ( 'should replace current path when link begins with "#!/" and history enabled on old browser' , function ( ) {
1247
1272
configureService ( '#!/link' , true , false , true ) ;
1248
1273
inject (
0 commit comments