fix(web): tag navigation from a missing path (#33052)
(cherry picked from commit f42c393d05a26aa5d0f8890aa8fc474f85a73fd8)
This commit is contained in:
1 parent
cca2dd7ece
commit
03ff181af3
3 files changed
+23
-1
No files matched your search
@@ -45,7 +45,7 @@
|
||||
let timelineManager = $state<TimelineManager>() as TimelineManager;
|
||||
const options = $derived({ deferInit: !tag, tagId: tag?.id });
|
||||
|
||||
const handleNavigation = (tag: string) => navigateToView(joinPaths(data.path, tag));
|
||||
const handleNavigation = (child: string) => navigateToView(joinPaths(tag.path, child));
|
||||
|
||||
const getLink = (path: string) => Route.tags({ path });
|
||||
|
||||
|
||||
@@ -53,6 +53,10 @@ export const createApp = (page: Page, data: MockData) => {
|
||||
createAlbumButton: button('create_album'),
|
||||
},
|
||||
|
||||
tags: {
|
||||
child: (name: string) => page.getByRole('main').getByRole('button', { name, exact: true }),
|
||||
},
|
||||
|
||||
album: {
|
||||
summary: page.getByTestId('album-details'),
|
||||
selectPhotosButton: button('select_photos'),
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
import { Route } from '#lib/route.ts';
|
||||
import { factory } from '#test/common/factories.ts';
|
||||
import { expect, test } from '#test/medium/fixtures.ts';
|
||||
|
||||
test('navigation keeps working after opening a tag path that does not exist', async ({ page, data, app }) => {
|
||||
const travel = factory.tag({ name: 'Travel' });
|
||||
const japan = factory.tag({ name: 'Japan', value: 'Travel/Japan', parentId: travel.id });
|
||||
const tokyo = factory.tag({ name: 'Tokyo', value: 'Travel/Japan/Tokyo', parentId: japan.id });
|
||||
data.addTags([travel, japan, tokyo]);
|
||||
await page.goto(Route.tags({ path: 'Missing' }));
|
||||
|
||||
await app.tags.child('Travel').click();
|
||||
await expect(page).toHaveURL(Route.tags({ path: 'Travel' }));
|
||||
|
||||
await app.tags.child('Japan').click();
|
||||
await expect(page).toHaveURL(Route.tags({ path: 'Travel/Japan' }));
|
||||
await expect(app.tags.child('Tokyo')).toBeVisible();
|
||||
});
|
||||
Reference in new issue
Block a user