feat(platform-web): preserve protocol in vehicle links

This commit is contained in:
lingniu
2026-07-04 01:15:39 +08:00
parent 8e5cb5b8c7
commit 657674f233
4 changed files with 41 additions and 15 deletions

View File

@@ -3,9 +3,10 @@ import { buildAppHash, parseAppHash } from './appRoute';
describe('parseAppHash', () => {
test('parses detail page keyword from hash query', () => {
expect(parseAppHash('#/detail?keyword=%E7%B2%A4AG18312')).toEqual({
expect(parseAppHash('#/detail?keyword=%E7%B2%A4AG18312&protocol=JT808')).toEqual({
page: 'detail',
keyword: '粤AG18312'
keyword: '粤AG18312',
protocol: 'JT808'
});
});
@@ -16,7 +17,7 @@ describe('parseAppHash', () => {
describe('buildAppHash', () => {
test('builds shareable vehicle page hash with encoded keyword', () => {
expect(buildAppHash({ page: 'history', keyword: '粤AG18312' })).toBe('#/history?keyword=%E7%B2%A4AG18312');
expect(buildAppHash({ page: 'history', keyword: '粤AG18312', protocol: 'GB32960' })).toBe('#/history?keyword=%E7%B2%A4AG18312&protocol=GB32960');
});
test('builds page-only hash when keyword is empty', () => {