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', () => {
156
156
hash : '#hash' ,
157
157
query : { } ,
158
158
} )
159
+ expect ( parseURL ( '/foo#hash' ) ) . toEqual ( {
160
+ fullPath : '/foo#hash' ,
161
+ path : '/foo' ,
162
+ hash : '#hash' ,
163
+ query : { } ,
164
+ } )
159
165
expect ( parseURL ( '/foo?' ) ) . toEqual ( {
160
166
fullPath : '/foo?' ,
161
167
path : '/foo' ,
162
168
hash : '' ,
163
169
query : { } ,
164
170
} )
171
+ expect ( parseURL ( '/foo' ) ) . toEqual ( {
172
+ fullPath : '/foo' ,
173
+ path : '/foo' ,
174
+ hash : '' ,
175
+ query : { } ,
176
+ } )
165
177
} )
166
178
167
179
it ( 'works with empty hash' , ( ) => {
@@ -177,6 +189,12 @@ describe('parseURL', () => {
177
189
hash : '#' ,
178
190
query : { } ,
179
191
} )
192
+ expect ( parseURL ( '/foo' ) ) . toEqual ( {
193
+ fullPath : '/foo' ,
194
+ path : '/foo' ,
195
+ hash : '' ,
196
+ query : { } ,
197
+ } )
180
198
} )
181
199
182
200
it ( 'works with a relative paths' , ( ) => {
@@ -198,7 +216,20 @@ describe('parseURL', () => {
198
216
hash : '' ,
199
217
query : { } ,
200
218
} )
219
+ // cannot go below root
220
+ expect ( parseURL ( '../../foo' , '/parent/bar' ) ) . toEqual ( {
221
+ fullPath : '/foo' ,
222
+ path : '/foo' ,
223
+ hash : '' ,
224
+ query : { } ,
225
+ } )
201
226
227
+ expect ( parseURL ( '' , '/parent/bar' ) ) . toEqual ( {
228
+ fullPath : '/parent/bar' ,
229
+ path : '/parent/bar' ,
230
+ hash : '' ,
231
+ query : { } ,
232
+ } )
202
233
expect ( parseURL ( '#foo' , '/parent/bar' ) ) . toEqual ( {
203
234
fullPath : '/parent/bar#foo' ,
204
235
path : '/parent/bar' ,
You can’t perform that action at this time.
0 commit comments