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

@@ -127,6 +127,28 @@ describe('drawing upload flow', () => {
).toBeTruthy()
})
it('a download that ends after another draft opened holds nothing in the new session', async () => {
const stored = serverGets(svg('0 0 200 100'))
let release: (bytes: Uint8Array) => void = () => {}
const held = new Promise<Uint8Array>((resolve) => (release = resolve))
sb.downloadSheetDrawing.mockImplementation(async (_c, hash) =>
hash === stored.sha256 ? held : await baseBytes(),
)
await pick(svg('0 0 200 100'))
await waitFor(() =>
expect(sb.downloadSheetDrawing).toHaveBeenCalledWith({}, stored.sha256),
)
store.getState().close()
await openReady()
const session = store.getState().session
release(stored.bytes)
await new Promise((done) => setTimeout(done, 50))
expect(store.getState().session).toBe(session)
expect(store.getState().drawings.map((d) => d.asset_id)).not.toContain(
NEW_ASSET,
)
})
it('a cleanable file shows the dialog with the core-composed drawing, then uploads on accept', async () => {
const dirty = svg(
'0 0 200 100',