From 567ad40c80fa334a9d212b7876135f4a44266676 Mon Sep 17 00:00:00 2001 From: bchanot Date: Mon, 26 Oct 2026 02:11:15 +0100 Subject: [PATCH] =?UTF-8?q?fix(app):=20the=20=C2=AB=20Client=20introuvable?= =?UTF-8?q?=20=C2=BB=20screen=20focuses=20its=20heading=20too?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Every client screen focuses its heading when it opens (contract §11.7); the not-found screen did not. Unit and Chromium tests now assert the focus. Found by the V1-1.5 verifier. --- apps/app/e2e/shell/clients.spec.ts | 2 +- apps/app/src/components/clients/ClientNotFound.tsx | 8 ++++---- apps/app/tests/unit/routes.clients.test.tsx | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/apps/app/e2e/shell/clients.spec.ts b/apps/app/e2e/shell/clients.spec.ts index 4096862d..f89feb25 100644 --- a/apps/app/e2e/shell/clients.spec.ts +++ b/apps/app/e2e/shell/clients.spec.ts @@ -369,7 +369,7 @@ for (const [locale, dict] of LANGUAGES) { level: 1, name: dict['clients.not_found.title'], }), - ).toBeVisible() + ).toBeFocused() await expect(page.getByText(secret)).toHaveCount(0) } await expectAccessible(page, 'the client not found screen') diff --git a/apps/app/src/components/clients/ClientNotFound.tsx b/apps/app/src/components/clients/ClientNotFound.tsx index d8138274..02a015ac 100644 --- a/apps/app/src/components/clients/ClientNotFound.tsx +++ b/apps/app/src/components/clients/ClientNotFound.tsx @@ -1,18 +1,18 @@ import ButtonLink from '@/components/ui/ButtonLink' import Card from '@/components/ui/Card' +import { usePageHeading } from '@/app/usePageHeading' import { useT } from '@/i18n/useT' /** The same screen for an unknown id and an id of another workspace (contract §11.1). */ export default function ClientNotFound() { const t = useT() + const heading = usePageHeading() return ( -

+

{t('clients.not_found.title')}

-

- {t('clients.not_found.body')} -

+

{t('clients.not_found.body')}

{t('clients.not_found.back')} diff --git a/apps/app/tests/unit/routes.clients.test.tsx b/apps/app/tests/unit/routes.clients.test.tsx index cadc10ea..9e4c6d42 100644 --- a/apps/app/tests/unit/routes.clients.test.tsx +++ b/apps/app/tests/unit/routes.clients.test.tsx @@ -294,7 +294,7 @@ describe('client edit', () => { describe('client page', () => { it('shows the same « introuvable » for an unknown id and a malformed one', async () => { mount(`/app/clients/${ID}`) - expect(await screen.findByRole('heading', { name: fr['clients.not_found.title'] })).toBeInTheDocument() + expect(await screen.findByRole('heading', { name: fr['clients.not_found.title'] })).toHaveFocus() cleanup() mount('/app/clients/not-an-id') expect(await screen.findByRole('heading', { name: fr['clients.not_found.title'] })).toBeInTheDocument()