fix(app): the « Client introuvable » screen focuses its heading too
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.
This commit is contained in:
1 parent
e1c1980949
commit
567ad40c80
3 files changed
+6
-6
No files matched your search
@@ -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')
|
||||
|
||||
@@ -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 (
|
||||
<Card as="section" className="space-y-3 p-5 sm:p-6">
|
||||
<h1 className="font-serif text-2xl text-[var(--color-ink)]">
|
||||
<h1 ref={heading} tabIndex={-1} className="outline-none font-serif text-2xl text-[var(--color-ink)]">
|
||||
{t('clients.not_found.title')}
|
||||
</h1>
|
||||
<p className="text-sm text-[var(--color-ink-muted)]">
|
||||
{t('clients.not_found.body')}
|
||||
</p>
|
||||
<p className="text-sm text-[var(--color-ink-muted)]">{t('clients.not_found.body')}</p>
|
||||
<ButtonLink to="/app/clients" variant="secondary">
|
||||
{t('clients.not_found.back')}
|
||||
</ButtonLink>
|
||||
|
||||
@@ -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()
|
||||
|
||||
Reference in new issue
Block a user