From a8c27f9d4a283f947e5acd9b825ecf7eeb00cdde Mon Sep 17 00:00:00 2001 From: jubnl Date: Tue, 21 Apr 2026 22:51:48 +0200 Subject: [PATCH] test: update tests to match translated share link button and desktop two-column map layout MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 'Remove share link' → 'Delete link' (now uses share.deleteLink i18n key) - FE-PAGE-PUBLICJOURNEY-009/012: map tab no longer exists in desktop two-column layout; map is always rendered in the sidebar — tests updated to verify the journey-map testid is present without requiring a tab click --- client/src/pages/JourneyDetailPage.test.tsx | 8 ++--- client/src/pages/JourneyPublicPage.test.tsx | 36 +++++++-------------- 2 files changed, 15 insertions(+), 29 deletions(-) diff --git a/client/src/pages/JourneyDetailPage.test.tsx b/client/src/pages/JourneyDetailPage.test.tsx index 390f1cfc..3abdc2e3 100644 --- a/client/src/pages/JourneyDetailPage.test.tsx +++ b/client/src/pages/JourneyDetailPage.test.tsx @@ -1468,7 +1468,7 @@ describe('JourneyDetailPage', () => { // ── FE-PAGE-JOURNEYDETAIL-074 ────────────────────────────────────────── describe('FE-PAGE-JOURNEYDETAIL-074: Delete share link removes it', () => { - it('clicking "Remove share link" calls DELETE and returns to create state', async () => { + it('clicking "Delete link" calls DELETE and returns to create state', async () => { const user = userEvent.setup({ advanceTimers: vi.advanceTimersByTime }); let deleteCalled = false; @@ -1493,10 +1493,10 @@ describe('JourneyDetailPage', () => { await openSettingsDialog(user); await waitFor(() => { - expect(screen.getByText('Remove share link')).toBeInTheDocument(); + expect(screen.getByText('Delete link')).toBeInTheDocument(); }); - await user.click(screen.getByText('Remove share link')); + await user.click(screen.getByText('Delete link')); await waitFor(() => { expect(deleteCalled).toBe(true); @@ -2905,7 +2905,7 @@ describe('JourneyDetailPage', () => { // The permission toggles show Timeline, Gallery, Map labels within the share section // These reuse the same i18n keys as the main tab bar - expect(screen.getByText('Remove share link')).toBeInTheDocument(); + expect(screen.getByText('Delete link')).toBeInTheDocument(); expect(screen.getByText('Copy')).toBeInTheDocument(); }); }); diff --git a/client/src/pages/JourneyPublicPage.test.tsx b/client/src/pages/JourneyPublicPage.test.tsx index d831a485..1702a7d0 100644 --- a/client/src/pages/JourneyPublicPage.test.tsx +++ b/client/src/pages/JourneyPublicPage.test.tsx @@ -234,28 +234,20 @@ describe('JourneyPublicPage', () => { } }); - it('FE-PAGE-PUBLICJOURNEY-009: map tab switches view', async () => { + it('FE-PAGE-PUBLICJOURNEY-009: map is always visible in desktop two-column layout', async () => { setupSuccess(); render(); await waitFor(() => { expect(screen.getByText('Tokyo 2026')).toBeInTheDocument(); }); - const buttons = screen.getAllByRole('button'); - const mapBtn = buttons.find( - btn => btn.textContent && /map/i.test(btn.textContent), - ); - expect(mapBtn).toBeDefined(); - if (mapBtn) { - fireEvent.click(mapBtn); - // After clicking map tab, the timeline entries should no longer be visible - // and the map view content should be rendered (even if JourneyMap errors internally - // due to jsdom limitations, the tab state switches) - await waitFor(() => { - // Shibuya Crossing (timeline-only) should not appear once map is active - expect(screen.queryByText('Shibuya Crossing')).not.toBeInTheDocument(); - }); - } + // Desktop two-column: map sidebar is always rendered alongside the timeline; + // there is no standalone "Map" tab button on desktop. + await waitFor(() => { + expect(screen.getByTestId('journey-map')).toBeInTheDocument(); + }); + // Timeline entries remain visible (two-column shows both simultaneously) + expect(screen.getByText('Shibuya Crossing')).toBeInTheDocument(); }); it('FE-PAGE-PUBLICJOURNEY-010: shows journey stats', async () => { @@ -303,24 +295,18 @@ describe('JourneyPublicPage', () => { }); // FE-PAGE-PUBLICJOURNEY-012 - it('FE-PAGE-PUBLICJOURNEY-012: tab switching from timeline to map shows map component', async () => { - const user = userEvent.setup(); + it('FE-PAGE-PUBLICJOURNEY-012: map component renders with located entries in desktop two-column layout', async () => { setupSuccess(); render(); await waitFor(() => { expect(screen.getByText('Tokyo 2026')).toBeInTheDocument(); }); - const mapBtn = screen.getAllByRole('button').find( - btn => btn.textContent && /map/i.test(btn.textContent), - ); - expect(mapBtn).toBeDefined(); - await user.click(mapBtn!); - + // Desktop two-column: map sidebar is always rendered; no tab click required. await waitFor(() => { expect(screen.getByTestId('journey-map')).toBeInTheDocument(); }); - // Map receives entries with lat/lng + // Both fixture entries have coordinates → map receives 2 located entries expect(screen.getByTestId('journey-map').textContent).toContain('2'); });