fix(core): various broken anchor link fixes (#9732)

This commit is contained in:
Sébastien Lorber 2024-01-12 16:09:45 +01:00 committed by GitHub
parent d94adf6a6c
commit 4388267c26
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
63 changed files with 345 additions and 115 deletions

View file

@ -301,6 +301,29 @@ describe('parseURLPath', () => {
});
});
it('parse anchor', () => {
expect(parseURLPath('#anchor')).toEqual({
pathname: '/',
search: undefined,
hash: 'anchor',
});
expect(parseURLPath('#anchor', '/page')).toEqual({
pathname: '/page',
search: undefined,
hash: 'anchor',
});
expect(parseURLPath('#')).toEqual({
pathname: '/',
search: undefined,
hash: '',
});
expect(parseURLPath('#', '/page')).toEqual({
pathname: '/page',
search: undefined,
hash: '',
});
});
it('parse hash', () => {
expect(parseURLPath('/page')).toEqual({
pathname: '/page',