mirror of
https://github.com/mauriceboe/TREK.git
synced 2026-10-24 16:03:02 +00:00
31859651d7
Every help screen checked against the v5 redesign. Tours is documented for the first time, as a screen of its own with twelve screens under it, and notifications get help of their own. All pictures are taken again on a realistic demo trip, with short loops where a still cannot show the motion. The English is plain and every language is written naturally rather than word for word. The switcher shows two levels at most, a screen's overview lists its sub-screens as cards above its guides, each wiki page is linked once, and the help sidebar is wider. Fixes found along the way: Save to Collection keeps a tour's route, a track dropped on the places column opens the Tours import, tour Share on desktop, the unsaved tour draft lives on the account, a route click no longer adds an end point, Trip places leaves the trip's tours out, Escape closes a stage's day menu, confirms before destructive deletes, DWD warnings sharing one id kept apart, a booking's date moves with it, and smaller fixes across notifications, bookings, the day plan, stays, Atlas, Collections, Vacay and the admin screens.
68 lines
2.5 KiB
TypeScript
68 lines
2.5 KiB
TypeScript
import React from 'react';
|
|
import { describe, it, expect, beforeEach } from 'vitest';
|
|
import userEvent from '@testing-library/user-event';
|
|
import { render, screen, waitFor } from '../../../helpers/render';
|
|
import { resetAllStores } from '../../../helpers/store';
|
|
import MNotifications from '../../../../src/mobile/screens/notifications/MNotifications';
|
|
|
|
// FE-MOB-NOTIF-001 onwards
|
|
|
|
beforeEach(() => {
|
|
resetAllStores();
|
|
});
|
|
|
|
describe('MNotifications', () => {
|
|
it('FE-MOB-NOTIF-001: loads the first page with unread badge and bulk actions', async () => {
|
|
render(<MNotifications />);
|
|
|
|
// Default handler: 25 notifications (page of 20), unread_count 5.
|
|
await waitFor(() => {
|
|
expect(screen.getAllByText('notif.title')).toHaveLength(20);
|
|
});
|
|
expect(screen.getByText('5')).toBeInTheDocument();
|
|
expect(screen.getByRole('button', { name: 'Mark all read' })).toBeInTheDocument();
|
|
expect(screen.getByRole('button', { name: 'Delete all' })).toBeInTheDocument();
|
|
expect(screen.getByRole('button', { name: 'Back' })).toBeInTheDocument();
|
|
});
|
|
|
|
it('FE-MOB-NOTIF-001b: Delete all asks for confirmation before it clears the list', async () => {
|
|
const user = userEvent.setup();
|
|
render(<MNotifications />);
|
|
await waitFor(() => {
|
|
expect(screen.getAllByText('notif.title')).toHaveLength(20);
|
|
});
|
|
|
|
await user.click(screen.getByRole('button', { name: 'Delete all' }));
|
|
expect(screen.getAllByText('notif.title')).toHaveLength(20);
|
|
|
|
await user.click(screen.getByRole('button', { name: 'Cancel' }));
|
|
expect(screen.getAllByText('notif.title')).toHaveLength(20);
|
|
|
|
await user.click(screen.getByRole('button', { name: 'Delete all' }));
|
|
await user.click(screen.getAllByRole('button', { name: 'Delete all' }).slice(-1)[0]);
|
|
await waitFor(() => {
|
|
expect(screen.queryAllByText('notif.title')).toHaveLength(0);
|
|
});
|
|
});
|
|
|
|
it('FE-MOB-NOTIF-002: the unread segment filters out read notifications', async () => {
|
|
const user = userEvent.setup();
|
|
render(<MNotifications />);
|
|
|
|
await waitFor(() => {
|
|
expect(screen.getAllByText('notif.title')).toHaveLength(20);
|
|
});
|
|
|
|
// First 5 rows of the default handler are unread.
|
|
await user.click(screen.getByRole('tab', { name: 'Unread' }));
|
|
await waitFor(() => {
|
|
expect(screen.getAllByText('notif.title')).toHaveLength(5);
|
|
});
|
|
|
|
await user.click(screen.getByRole('tab', { name: 'All' }));
|
|
await waitFor(() => {
|
|
expect(screen.getAllByText('notif.title')).toHaveLength(20);
|
|
});
|
|
});
|
|
});
|