diff --git a/packages/router/__tests__/location.spec.ts b/packages/router/__tests__/location.spec.ts index 0511ad89f..7b7497687 100644 --- a/packages/router/__tests__/location.spec.ts +++ b/packages/router/__tests__/location.spec.ts @@ -156,12 +156,24 @@ describe('parseURL', () => { hash: '#hash', query: {}, }) + expect(parseURL('/foo#hash')).toEqual({ + fullPath: '/foo#hash', + path: '/foo', + hash: '#hash', + query: {}, + }) expect(parseURL('/foo?')).toEqual({ fullPath: '/foo?', path: '/foo', hash: '', query: {}, }) + expect(parseURL('/foo')).toEqual({ + fullPath: '/foo', + path: '/foo', + hash: '', + query: {}, + }) }) it('works with empty hash', () => { @@ -177,6 +189,12 @@ describe('parseURL', () => { hash: '#', query: {}, }) + expect(parseURL('/foo')).toEqual({ + fullPath: '/foo', + path: '/foo', + hash: '', + query: {}, + }) }) it('works with a relative paths', () => { @@ -198,7 +216,20 @@ describe('parseURL', () => { hash: '', query: {}, }) + // cannot go below root + expect(parseURL('../../foo', '/parent/bar')).toEqual({ + fullPath: '/foo', + path: '/foo', + hash: '', + query: {}, + }) + expect(parseURL('', '/parent/bar')).toEqual({ + fullPath: '/parent/bar', + path: '/parent/bar', + hash: '', + query: {}, + }) expect(parseURL('#foo', '/parent/bar')).toEqual({ fullPath: '/parent/bar#foo', path: '/parent/bar',