mirror of
https://github.com/mauriceboe/TREK.git
synced 2026-06-19 13:21:46 +00:00
test: update tests to match translated share link button and desktop two-column map layout
- '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
This commit is contained in:
@@ -1468,7 +1468,7 @@ describe('JourneyDetailPage', () => {
|
|||||||
|
|
||||||
// ── FE-PAGE-JOURNEYDETAIL-074 ──────────────────────────────────────────
|
// ── FE-PAGE-JOURNEYDETAIL-074 ──────────────────────────────────────────
|
||||||
describe('FE-PAGE-JOURNEYDETAIL-074: Delete share link removes it', () => {
|
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 });
|
const user = userEvent.setup({ advanceTimers: vi.advanceTimersByTime });
|
||||||
let deleteCalled = false;
|
let deleteCalled = false;
|
||||||
|
|
||||||
@@ -1493,10 +1493,10 @@ describe('JourneyDetailPage', () => {
|
|||||||
await openSettingsDialog(user);
|
await openSettingsDialog(user);
|
||||||
|
|
||||||
await waitFor(() => {
|
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(() => {
|
await waitFor(() => {
|
||||||
expect(deleteCalled).toBe(true);
|
expect(deleteCalled).toBe(true);
|
||||||
@@ -2905,7 +2905,7 @@ describe('JourneyDetailPage', () => {
|
|||||||
|
|
||||||
// The permission toggles show Timeline, Gallery, Map labels within the share section
|
// The permission toggles show Timeline, Gallery, Map labels within the share section
|
||||||
// These reuse the same i18n keys as the main tab bar
|
// 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();
|
expect(screen.getByText('Copy')).toBeInTheDocument();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -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();
|
setupSuccess();
|
||||||
render(<JourneyPublicPage />);
|
render(<JourneyPublicPage />);
|
||||||
await waitFor(() => {
|
await waitFor(() => {
|
||||||
expect(screen.getByText('Tokyo 2026')).toBeInTheDocument();
|
expect(screen.getByText('Tokyo 2026')).toBeInTheDocument();
|
||||||
});
|
});
|
||||||
|
|
||||||
const buttons = screen.getAllByRole('button');
|
// Desktop two-column: map sidebar is always rendered alongside the timeline;
|
||||||
const mapBtn = buttons.find(
|
// there is no standalone "Map" tab button on desktop.
|
||||||
btn => btn.textContent && /map/i.test(btn.textContent),
|
await waitFor(() => {
|
||||||
);
|
expect(screen.getByTestId('journey-map')).toBeInTheDocument();
|
||||||
expect(mapBtn).toBeDefined();
|
});
|
||||||
if (mapBtn) {
|
// Timeline entries remain visible (two-column shows both simultaneously)
|
||||||
fireEvent.click(mapBtn);
|
expect(screen.getByText('Shibuya Crossing')).toBeInTheDocument();
|
||||||
// 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();
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it('FE-PAGE-PUBLICJOURNEY-010: shows journey stats', async () => {
|
it('FE-PAGE-PUBLICJOURNEY-010: shows journey stats', async () => {
|
||||||
@@ -303,24 +295,18 @@ describe('JourneyPublicPage', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
// FE-PAGE-PUBLICJOURNEY-012
|
// FE-PAGE-PUBLICJOURNEY-012
|
||||||
it('FE-PAGE-PUBLICJOURNEY-012: tab switching from timeline to map shows map component', async () => {
|
it('FE-PAGE-PUBLICJOURNEY-012: map component renders with located entries in desktop two-column layout', async () => {
|
||||||
const user = userEvent.setup();
|
|
||||||
setupSuccess();
|
setupSuccess();
|
||||||
render(<JourneyPublicPage />);
|
render(<JourneyPublicPage />);
|
||||||
await waitFor(() => {
|
await waitFor(() => {
|
||||||
expect(screen.getByText('Tokyo 2026')).toBeInTheDocument();
|
expect(screen.getByText('Tokyo 2026')).toBeInTheDocument();
|
||||||
});
|
});
|
||||||
|
|
||||||
const mapBtn = screen.getAllByRole('button').find(
|
// Desktop two-column: map sidebar is always rendered; no tab click required.
|
||||||
btn => btn.textContent && /map/i.test(btn.textContent),
|
|
||||||
);
|
|
||||||
expect(mapBtn).toBeDefined();
|
|
||||||
await user.click(mapBtn!);
|
|
||||||
|
|
||||||
await waitFor(() => {
|
await waitFor(() => {
|
||||||
expect(screen.getByTestId('journey-map')).toBeInTheDocument();
|
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');
|
expect(screen.getByTestId('journey-map').textContent).toContain('2');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user