fix(editor): read-only undo, upload session check, restore and submit guards

This commit is contained in:
bchanot committed 2026-11-04 18:06:40 +01:00
1 parent 5979cd59ec
commit 05c9b3e10b
20 files changed
+102 -33

No files matched your search

@@ -67,13 +67,19 @@ describe('editor-wide undo', () => {
dialog.remove()
})
it('is off in a read-only mode', async () => {
mountDraft({ width: 800 })
it("is off in the narrow read-only mode, with the route's own store state", async () => {
mountDraft({ width: 1280 })
await ready()
store.getState().setCanEdit(true)
act(() => void commitMove(40))
store.getState().setCanEdit(false)
act(() => {
setWidth(800)
window.dispatchEvent(new Event('resize'))
})
await screen.findByText(/L'édition nécessite une largeur/)
// The route keeps the store able to hold a recovery copy in `narrow`: no forced flag.
expect(store.getState().canEdit).toBe(true)
ctrlZ(document.body)
expect(cx()).toMatchObject({ cx: 40 })
expect(store.getState().unsaved).toBe(true)
})
})