fix(editor): prove one Back reopens the sheet after the leave cascade
This commit is contained in:
1 parent
0ea94602d1
commit
ec314af009
1 file changed
+33
@@ -1064,6 +1064,39 @@ describe('the citations sheet over a dirty edit form (final review rev 4, item 1
|
|||||||
draftKept()
|
draftKept()
|
||||||
})
|
})
|
||||||
|
|
||||||
|
it('after the cascade keeps the form, one Back reopens the sheet (docs, limit 6)', async () => {
|
||||||
|
const user = await sheetOverDirtyForm()
|
||||||
|
const sheet = within(panelOpen()!)
|
||||||
|
const head = sheet.getByRole('button', { name: /^Alpha/ })
|
||||||
|
if (head.getAttribute('aria-expanded') === 'false') await user.click(head)
|
||||||
|
const tile = within(head.closest('li')!)
|
||||||
|
await user.click(tile.getByRole('button', { name: 'Modifier' }))
|
||||||
|
await waitFor(() => expect(refForm()).toBeDefined())
|
||||||
|
await user.type(within(refForm()!).getByLabelText('Citation'), ' x')
|
||||||
|
const url = new URL('/app/admin/sheets', window.location.origin).href
|
||||||
|
const event = Object.assign(new Event('navigate', { cancelable: true }), {
|
||||||
|
navigationType: 'traverse',
|
||||||
|
destination: { url, key: 'list', sameDocument: true },
|
||||||
|
})
|
||||||
|
act(() => {
|
||||||
|
api.dispatchEvent(event)
|
||||||
|
})
|
||||||
|
await user.click(
|
||||||
|
within(refForm()!).getByRole('button', { name: 'Abandonner' }),
|
||||||
|
)
|
||||||
|
await waitFor(() => expect(panelOpen()).toBeNull())
|
||||||
|
// The reference dialog plays its exit, then leaves: only the finding dialog stays.
|
||||||
|
await waitFor(() => expect(dialogs()).toHaveLength(1))
|
||||||
|
await user.click(
|
||||||
|
inDialog().getByRole('button', { name: 'Continuer la saisie' }),
|
||||||
|
)
|
||||||
|
await back()
|
||||||
|
await waitFor(() => expect(panelOpen()).not.toBeNull())
|
||||||
|
expect(screen.queryByText(question)).toBeNull()
|
||||||
|
expect(api.traverseTo).not.toHaveBeenCalled()
|
||||||
|
draftKept()
|
||||||
|
})
|
||||||
|
|
||||||
it('a jump out of the editor closes the sheet, then the form asks in view', async () => {
|
it('a jump out of the editor closes the sheet, then the form asks in view', async () => {
|
||||||
await sheetOverDirtyForm()
|
await sheetOverDirtyForm()
|
||||||
const url = new URL('/app/admin/sheets', window.location.origin).href
|
const url = new URL('/app/admin/sheets', window.location.origin).href
|
||||||
|
|||||||
Reference in new issue
Block a user