fix(editor): ask only the layers a Back removes, clear the sheet first
This commit is contained in:
1 parent
526aecb40e
commit
2ad720b34e
5 files changed
+193
-30
No files matched your search
@@ -109,13 +109,26 @@ describe('a Back over the finding layers', () => {
|
||||
it('a dirty layer keeps the page where it is: asked, the view pushed again', async () => {
|
||||
const guard = vi.fn(() => ({ allowed: false }))
|
||||
await openSheet(guard)
|
||||
// The sheet is no form: the Back that closes it alone asks nothing (rev 4, item 1).
|
||||
act(() => navigate(-1))
|
||||
expect(guard).not.toHaveBeenCalled()
|
||||
expect(layer()).toMatchObject({ citations: false })
|
||||
const before = entry().id
|
||||
act(() => navigate(-1))
|
||||
expect(guard).toHaveBeenCalledWith(false)
|
||||
expect(layer()).toMatchObject({ citations: true })
|
||||
expect(layer()).toMatchObject({ citations: false })
|
||||
expect(entry().id).not.toBe(before)
|
||||
expect(entry().view.finding).toMatchObject({ citations: true })
|
||||
expect(entry().below?.finding).toMatchObject({ citations: false })
|
||||
expect(entry().view.finding).toMatchObject({ citations: false })
|
||||
expect(entry().below?.finding).toBeNull()
|
||||
})
|
||||
|
||||
it('a jump that removes a dirty dialog under the sheet closes the sheet, then asks', async () => {
|
||||
const guard = vi.fn(() => ({ allowed: false }))
|
||||
await openSheet(guard)
|
||||
act(() => navigate(-2))
|
||||
expect(guard).toHaveBeenCalledWith(false)
|
||||
expect(layer()).toMatchObject({ citations: false })
|
||||
expect(entry().view.finding).toMatchObject({ citations: false })
|
||||
})
|
||||
|
||||
it('a modal that is no layer refuses the Back too', async () => {
|
||||
|
||||
Reference in new issue
Block a user