Files
TREK/client/tests/unit/mobile/MHintLabel.test.tsx
T
Maurice ae3dfa2eb7 feat(mobile): admin and settings sections ordered and trimmed like the desktop
- The phone's admin sections follow the desktop sidebar: the same groups
  (Users, Configuration, Maintenance) in its dropdown, Security and Services
  instead of one Settings section, and live flights and booking mails beside
  the addons they configure. An old ?tab=settings link still opens Security.
- Passkey login and the 2FA rule sit with the other ways in; the passkey card
  keeps the domain, and a managed install no longer shows the danger zone.
- MAdminSelect replaces every native select on the admin screens: TREK's own
  field or row pill that opens the picker sheet (permissions, backup schedule,
  invite trip, plugin settings).
- Explanations wait behind an info mark (MHintLabel), as on the desktop: admin
  rows and fields, the settings rows' new `hint`, addon and provider rows.
- Permissions are one line each with the level as a pill; addon rows lose the
  type badge their heading already names; settings buttons no longer wrap.
- "Require 2FA" in every language; admin.tabs.settings is unused and gone.
2026-11-14 10:49:09 +01:00

38 lines
1.7 KiB
TypeScript

// FE-MOB-HINT-001 to FE-MOB-HINT-004
import userEvent from '@testing-library/user-event';
import { describe, expect, it } from 'vitest';
import MHintLabel from '../../../src/mobile/components/MHintLabel';
import { render, screen } from '../../helpers/render';
describe('MHintLabel', () => {
it('FE-MOB-HINT-001: without a hint it is the label alone, with no mark', () => {
render(<MHintLabel label="Password Login" />);
expect(screen.getByText('Password Login')).toBeInTheDocument();
expect(screen.queryByTestId('m-hint-mark')).not.toBeInTheDocument();
});
it('FE-MOB-HINT-002: the hint stays in the page for a screen reader while the mark is closed', () => {
render(<MHintLabel label="Password Login" hint="Allow sign in with email and password" />);
const hint = screen.getByText('Allow sign in with email and password');
expect(hint).toHaveClass('sr-only');
expect(screen.getByTestId('m-hint-mark')).toHaveAttribute('aria-hidden', 'true');
});
it('FE-MOB-HINT-003: a tap on the mark shows the hint and a second one folds it again', async () => {
const user = userEvent.setup();
render(<MHintLabel label="Password Login" hint="Allow sign in with email and password" />);
const mark = screen.getByTestId('m-hint-mark');
await user.click(mark);
expect(screen.getByText('Allow sign in with email and password')).not.toHaveClass('sr-only');
await user.click(mark);
expect(screen.getByText('Allow sign in with email and password')).toHaveClass('sr-only');
});
it('FE-MOB-HINT-004: the label takes the class it is given', () => {
render(<MHintLabel label="Files" hint="Uploads" labelClassName="uppercase" />);
expect(screen.getByText('Files')).toHaveClass('uppercase');
});
});