fix(editor): Task 2 review round 1, trace calls, form hooks, keyboard proof
This commit is contained in:
1 parent
c893dec60b
commit
b703333b20
15 files changed
+476
-261
No files matched your search
@@ -330,6 +330,45 @@ describe('read-only flip and the gone rule', () => {
|
||||
expect(field).toHaveFocus()
|
||||
})
|
||||
|
||||
it('a flip to read-only while « Modifier » holds the focus keeps it in the dialog (the tab row is inert)', async () => {
|
||||
const user = await mount()
|
||||
await openFinding(user, /Cat A/)
|
||||
const button = inDialog().getByRole('button', { name: 'Modifier' })
|
||||
button.focus()
|
||||
expect(button).toHaveFocus()
|
||||
act(() => {
|
||||
setWidth(900)
|
||||
window.dispatchEvent(new Event('resize'))
|
||||
})
|
||||
// The edit-only actions left the page: the focus moved to the dialog's first control.
|
||||
expect(button.isConnected).toBe(false)
|
||||
expect(findingDialog()!.contains(document.activeElement)).toBe(true)
|
||||
})
|
||||
|
||||
it('a forced close of a dirty form says the dropped draft once, with the gone text', async () => {
|
||||
const user = await mount()
|
||||
await openFinding(user, /Node A/)
|
||||
await modify(user)
|
||||
await user.type(nameField(), ' bis')
|
||||
act(() => {
|
||||
store.getState().commit({
|
||||
op: 'remove',
|
||||
key: {
|
||||
kind: 'finding',
|
||||
zone_id: 'zone-a',
|
||||
path: ['fcat-a', 'fnode-a'],
|
||||
},
|
||||
})
|
||||
})
|
||||
await closed()
|
||||
const live = () => document.querySelector('p.sr-only[aria-live="polite"]')!
|
||||
await waitFor(() =>
|
||||
expect(live().textContent).toBe(
|
||||
"Saisie abandonnée. Ce constat n'existe plus",
|
||||
),
|
||||
)
|
||||
})
|
||||
|
||||
it('an element that vanishes closes its dialog by replace and says so', async () => {
|
||||
const user = await mount()
|
||||
await openFinding(user, /Node A/)
|
||||
|
||||
Reference in new issue
Block a user