File tree 2 files changed +10
-2
lines changed
2 files changed +10
-2
lines changed Original file line number Diff line number Diff line change @@ -350,8 +350,8 @@ var locationPrototype = {
350
350
return this . $$url ;
351
351
352
352
var match = PATH_MATCH . exec ( url ) ;
353
- if ( match [ 1 ] ) this . path ( decodeURIComponent ( match [ 1 ] ) ) ;
354
- if ( match [ 2 ] || match [ 1 ] ) this . search ( match [ 3 ] || '' ) ;
353
+ if ( match [ 1 ] || url === '' ) this . path ( decodeURIComponent ( match [ 1 ] ) ) ;
354
+ if ( match [ 2 ] || match [ 1 ] || url === '' ) this . search ( match [ 3 ] || '' ) ;
355
355
this . hash ( match [ 5 ] || '' ) ;
356
356
357
357
return this ;
Original file line number Diff line number Diff line change @@ -304,6 +304,14 @@ describe('$location', function() {
304
304
expect ( url . hash ( ) ) . toBe ( '' ) ;
305
305
} ) ;
306
306
307
+ it ( 'url() should change path when empty string specified' , function ( ) {
308
+ url . url ( '' ) ;
309
+
310
+ expect ( url . path ( ) ) . toBe ( '/' ) ;
311
+ expect ( url . search ( ) ) . toEqual ( { } ) ;
312
+ expect ( url . hash ( ) ) . toBe ( '' ) ;
313
+ } ) ;
314
+
307
315
308
316
it ( 'replace should set $$replace flag and return itself' , function ( ) {
309
317
expect ( url . $$replace ) . toBe ( false ) ;
You can’t perform that action at this time.
0 commit comments