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 @@ -343,8 +343,8 @@ LocationHashbangInHtml5Url.prototype =
343
343
return this . $$url ;
344
344
345
345
var match = PATH_MATCH . exec ( url ) ;
346
- if ( match [ 1 ] ) this . path ( decodeURIComponent ( match [ 1 ] ) ) ;
347
- if ( match [ 2 ] || match [ 1 ] ) this . search ( match [ 3 ] || '' ) ;
346
+ if ( match [ 1 ] || url === '' ) this . path ( decodeURIComponent ( match [ 1 ] ) ) ;
347
+ if ( match [ 2 ] || match [ 1 ] || url === '' ) this . search ( match [ 3 ] || '' ) ;
348
348
this . hash ( match [ 5 ] || '' ) ;
349
349
350
350
return this ;
Original file line number Diff line number Diff line change @@ -245,6 +245,14 @@ describe('$location', function() {
245
245
expect ( url . hash ( ) ) . toBe ( '' ) ;
246
246
} ) ;
247
247
248
+ it ( 'url() should change path when empty string specified' , function ( ) {
249
+ url . url ( '' ) ;
250
+
251
+ expect ( url . path ( ) ) . toBe ( '/' ) ;
252
+ expect ( url . search ( ) ) . toEqual ( { } ) ;
253
+ expect ( url . hash ( ) ) . toBe ( '' ) ;
254
+ } ) ;
255
+
248
256
249
257
it ( 'replace should set $$replace flag and return itself' , function ( ) {
250
258
expect ( url . $$replace ) . toBe ( false ) ;
You can’t perform that action at this time.
0 commit comments