File tree Expand file tree Collapse file tree 1 file changed +31
-0
lines changed
packages/router/__tests__ Expand file tree Collapse file tree 1 file changed +31
-0
lines changed Original file line number Diff line number Diff line change @@ -156,12 +156,24 @@ describe('parseURL', () => {
156156 hash : '#hash' ,
157157 query : { } ,
158158 } )
159+ expect ( parseURL ( '/foo#hash' ) ) . toEqual ( {
160+ fullPath : '/foo#hash' ,
161+ path : '/foo' ,
162+ hash : '#hash' ,
163+ query : { } ,
164+ } )
159165 expect ( parseURL ( '/foo?' ) ) . toEqual ( {
160166 fullPath : '/foo?' ,
161167 path : '/foo' ,
162168 hash : '' ,
163169 query : { } ,
164170 } )
171+ expect ( parseURL ( '/foo' ) ) . toEqual ( {
172+ fullPath : '/foo' ,
173+ path : '/foo' ,
174+ hash : '' ,
175+ query : { } ,
176+ } )
165177 } )
166178
167179 it ( 'works with empty hash' , ( ) => {
@@ -177,6 +189,12 @@ describe('parseURL', () => {
177189 hash : '#' ,
178190 query : { } ,
179191 } )
192+ expect ( parseURL ( '/foo' ) ) . toEqual ( {
193+ fullPath : '/foo' ,
194+ path : '/foo' ,
195+ hash : '' ,
196+ query : { } ,
197+ } )
180198 } )
181199
182200 it ( 'works with a relative paths' , ( ) => {
@@ -198,7 +216,20 @@ describe('parseURL', () => {
198216 hash : '' ,
199217 query : { } ,
200218 } )
219+ // cannot go below root
220+ expect ( parseURL ( '../../foo' , '/parent/bar' ) ) . toEqual ( {
221+ fullPath : '/foo' ,
222+ path : '/foo' ,
223+ hash : '' ,
224+ query : { } ,
225+ } )
201226
227+ expect ( parseURL ( '' , '/parent/bar' ) ) . toEqual ( {
228+ fullPath : '/parent/bar' ,
229+ path : '/parent/bar' ,
230+ hash : '' ,
231+ query : { } ,
232+ } )
202233 expect ( parseURL ( '#foo' , '/parent/bar' ) ) . toEqual ( {
203234 fullPath : '/parent/bar#foo' ,
204235 path : '/parent/bar' ,
You can’t perform that action at this time.
0 commit comments