fix(editor): read-only undo, upload session check, restore and submit guards
This commit is contained in:
1 parent
5979cd59ec
commit
05c9b3e10b
20 files changed
+102
-33
No files matched your search
@@ -437,8 +437,8 @@ Every key below is a proposal for the owner's separate review; none is declared
|
||||
| `editor.verification.issue.annotation.no_findings` | Cette annotation n'est liée à aucune zone de constats : un clic dessus ne proposera rien. | This annotation is linked to no findings zone: a click on it will offer nothing. | Warning | proposal |
|
||||
| `editor.verification.issue.annotation.geometry.missing` | Cette annotation n'a pas de géométrie. | This annotation has no geometry. | Issue | proposal |
|
||||
| `editor.verification.issue.annotation.geometry.out_of_frame` | Cette annotation n'est pas entièrement dans le cadre de sa vue. | This annotation is not entirely inside the frame of its view. | Issue | proposal |
|
||||
| `editor.verification.issue.annotation.geometry.too_small` | Cette annotation s'affiche trop petite sur l'aperçu téléphone. | This annotation shows too small on the phone preview. | Issue | proposal |
|
||||
| `editor.verification.issue.annotation.geometry.interior_too_small` | L'intérieur de cette zone est trop étroit pour être touché sur l'aperçu téléphone. | The inside of this zone is too narrow to tap on the phone preview. | Issue | proposal |
|
||||
| `editor.verification.issue.annotation.geometry.too_small` | Un repère est trop petit pour être touché sur mobile. | A marker is too small to tap on a phone. | Issue | ratified, reused (REVUE.md Arbitrages `marker_too_small`, §17.9) |
|
||||
| `editor.verification.issue.annotation.geometry.interior_too_small` | L'intérieur d'une zone est trop étroit pour être touché sur mobile. | A zone's interior is too narrow to tap on a phone. | Issue | ratified, reused (REVUE.md `marker_interior_too_small`) |
|
||||
| `editor.verification.issue.region.code.duplicate` | Deux régions vertébrales ont le même code. | Two vertebral regions have the same code. | Issue | proposal |
|
||||
| `editor.verification.issue.region.count_range.invalid` | Le nombre habituel de cette région n'est pas dans la variation indiquée. | The usual count of this region is outside the stated variation. | Issue | proposal |
|
||||
| `editor.verification.issue.category.id.duplicate` | Deux catégories d'annotation ont le même identifiant. | Two annotation categories have the same id. | Issue | proposal |
|
||||
@@ -472,3 +472,9 @@ about the local copy says it is temporary, limited to this tab and not saved on
|
||||
| `editor.refusal.recovery` | Répondez d'abord à la copie locale temporaire de cet onglet proposée en haut de page : elle n'est pas enregistrée sur le serveur. | First answer this tab's temporary local copy offered at the top of the page: it is not saved on the server. | Three facts (C25) |
|
||||
| `admin.failure.round.open` | Une revue est déjà en cours sur ce brouillon : il ne peut pas être soumis de nouveau. | A review is already under way on this draft: it cannot be submitted again. | New: `submit_sheet_review` raises `round.open`; it read « Le service ne répond pas » |
|
||||
| `admin.failure.view.asset.unknown` | Une illustration du brouillon n'est pas enregistrée pour cette fiche : choisissez-la de nouveau dans l'onglet Vues et illustrations. | A drawing of the draft is not registered for this sheet: choose it again in the Views and drawings tab. | New: raised by `submit_sheet_review` and publication |
|
||||
|
||||
### Lot M fix 3
|
||||
| Key | FR | EN | Why |
|
||||
|---|---|---|---|
|
||||
| `editor.draft.status.copy_quota` | Copie locale temporaire impossible (onglet plein) : non enregistré sur le serveur | Temporary local copy impossible (tab full): not saved on the server | C25: header status said nothing about the server (was « …(stockage de l'onglet plein) ») |
|
||||
| `editor.draft.status.copy_cap` | Copie locale temporaire impossible (deux autres copies dans cet onglet) : non enregistré sur le serveur | Temporary local copy impossible (two other copies in this tab): not saved on the server | C25 (was « …: deux autres brouillons ont déjà une copie dans cet onglet ») |
|
||||
@@ -72,7 +72,7 @@ async function expectReadOnly(page: Page) {
|
||||
test.describe('editor access, narrow screens and axe', () => {
|
||||
test.use({ locale: 'fr-FR', actionTimeout: 15_000 })
|
||||
test.beforeEach(async ({ context }, info) => {
|
||||
test.skip(isPhone(info), 'the widths are set by the tests themselves')
|
||||
test.skip(isPhone(info), 'the widths are set by the tests themselves') // floor-guard: allow C16 editing needs >= 1024 px; phone read-only covered in editor-access
|
||||
await routeToSandbox(context)
|
||||
})
|
||||
test.afterEach(async ({ context }) => {
|
||||
|
||||
@@ -68,7 +68,7 @@ async function openAnnotations(page: Page) {
|
||||
test.describe('editor annotations (A3)', () => {
|
||||
test.use({ locale: 'fr-FR', actionTimeout: 15_000 })
|
||||
test.beforeEach(async ({ context }, info) => {
|
||||
test.skip(isPhone(info), 'editing needs 1 024 px')
|
||||
test.skip(isPhone(info), 'editing needs 1 024 px') // floor-guard: allow C16 editing needs >= 1024 px; phone read-only covered in editor-access
|
||||
await routeToSandbox(context)
|
||||
})
|
||||
test.afterEach(async ({ context }) => {
|
||||
|
||||
@@ -39,7 +39,7 @@ const mainDrawing = (page: Page) => page.getByTestId('view-main-drawing')
|
||||
test.describe('editor drawings (A2)', () => {
|
||||
test.use({ locale: 'fr-FR', actionTimeout: 15_000 })
|
||||
test.beforeEach(async ({ context }, info) => {
|
||||
test.skip(isPhone(info), 'editing needs 1 024 px')
|
||||
test.skip(isPhone(info), 'editing needs 1 024 px') // floor-guard: allow C16 editing needs >= 1024 px; phone read-only covered in editor-access
|
||||
await routeToSandbox(context)
|
||||
})
|
||||
test.afterEach(async ({ context }) => {
|
||||
|
||||
@@ -211,7 +211,7 @@ test.describe('equine working copy and commit latency', () => {
|
||||
test.use({ locale: 'fr-FR', actionTimeout: 30_000 })
|
||||
// Skipped as a whole on the phone project: beforeAll and afterAll toggle the copies'
|
||||
// status and must run in one worker only.
|
||||
test.skip(({ isMobile }) => isMobile, 'editing needs 1 024 px')
|
||||
test.skip(({ isMobile }) => isMobile, 'editing needs 1 024 px') // floor-guard: allow C16 editing needs >= 1024 px; phone read-only covered in editor-access
|
||||
let actor: Actor
|
||||
let setAside: string[] = []
|
||||
let copyId = ''
|
||||
|
||||
@@ -67,7 +67,7 @@ async function open(page: Page, ...annotations: unknown[]) {
|
||||
test.describe('editor geometry (adversarial)', () => {
|
||||
test.use({ locale: 'fr-FR', actionTimeout: 15_000 })
|
||||
test.beforeEach(async ({ context }, info) => {
|
||||
test.skip(isPhone(info), 'editing needs 1 024 px')
|
||||
test.skip(isPhone(info), 'editing needs 1 024 px') // floor-guard: allow C16 editing needs >= 1024 px; phone read-only covered in editor-access
|
||||
await routeToSandbox(context)
|
||||
})
|
||||
test.afterEach(async ({ context }) => {
|
||||
@@ -255,10 +255,7 @@ test.describe('editor touch path (real browser)', () => {
|
||||
viewport: { width: 1280, height: 800 },
|
||||
})
|
||||
test.beforeEach(async ({ context }, info) => {
|
||||
test.skip(
|
||||
isPhone(info),
|
||||
'a 1 024 px touch screen runs on the desktop project',
|
||||
)
|
||||
test.skip(isPhone(info), 'touch at 1 024 px runs on desktop') // floor-guard: allow C16 editing needs >= 1024 px; phone read-only covered in editor-access
|
||||
await routeToSandbox(context)
|
||||
})
|
||||
test.afterEach(async ({ context }) => {
|
||||
|
||||
@@ -242,7 +242,7 @@ async function reloadAndRestore(page: Page, sheetId: string) {
|
||||
test.describe('editor journey (owner trial steps)', () => {
|
||||
test.use({ locale: 'fr-FR', actionTimeout: 15_000 })
|
||||
test.beforeEach(async ({ context }, info) => {
|
||||
test.skip(isPhone(info), 'editing needs 1 024 px')
|
||||
test.skip(isPhone(info), 'editing needs 1 024 px') // floor-guard: allow C16 editing needs >= 1024 px; phone read-only covered in editor-access
|
||||
await routeToSandbox(context)
|
||||
})
|
||||
test.afterEach(async ({ context }) => {
|
||||
|
||||
@@ -83,7 +83,7 @@ async function advanceServer(actor: Actor, draftId: string, revision: number) {
|
||||
test.describe('editor recovery and concurrency', () => {
|
||||
test.use({ locale: 'fr-FR', actionTimeout: 15_000 })
|
||||
test.beforeEach(async ({ context }, info) => {
|
||||
test.skip(isPhone(info), 'editing needs 1 024 px')
|
||||
test.skip(isPhone(info), 'editing needs 1 024 px') // floor-guard: allow C16 editing needs >= 1024 px; phone read-only covered in editor-access
|
||||
await routeToSandbox(context)
|
||||
})
|
||||
test.afterEach(async ({ context }) => {
|
||||
@@ -313,7 +313,7 @@ test.describe('editor recovery and concurrency', () => {
|
||||
test.describe('rights changing under an open editing session', () => {
|
||||
test.use({ locale: 'fr-FR', actionTimeout: 15_000 })
|
||||
test.beforeEach(async ({ context }, info) => {
|
||||
test.skip(isPhone(info), 'editing needs 1 024 px')
|
||||
test.skip(isPhone(info), 'editing needs 1 024 px') // floor-guard: allow C16 editing needs >= 1024 px; phone read-only covered in editor-access
|
||||
await routeToSandbox(context)
|
||||
})
|
||||
test.afterEach(async ({ context }) => {
|
||||
|
||||
@@ -41,7 +41,7 @@ async function commitText(field: Locator, value: string) {
|
||||
test.describe('editor structures (A4)', () => {
|
||||
test.use({ locale: 'fr-FR', actionTimeout: 15_000 })
|
||||
test.beforeEach(async ({ context }, info) => {
|
||||
test.skip(isPhone(info), 'editing needs 1 024 px')
|
||||
test.skip(isPhone(info), 'editing needs 1 024 px') // floor-guard: allow C16 editing needs >= 1024 px; phone read-only covered in editor-access
|
||||
await routeToSandbox(context)
|
||||
})
|
||||
test.afterEach(async ({ context }) => {
|
||||
|
||||
@@ -106,7 +106,7 @@ function DraftEditor({
|
||||
}, [versionId, userId])
|
||||
useEffect(() => useEditorStore.getState().setCanEdit(canEdit), [canEdit])
|
||||
useLeaveGuard(useEditorStore(leaveGuardArmed))
|
||||
useUndoShortcuts(canEdit && recovery === 'none')
|
||||
useUndoShortcuts(mode === 'edit' && recovery === 'none')
|
||||
|
||||
if (status === 'failed' && failure !== null) {
|
||||
if (failure === 'denied') return <AccessDenied />
|
||||
|
||||
@@ -147,10 +147,12 @@ export async function registerAndUpload(
|
||||
export async function downloadAndHold(
|
||||
assetId: string,
|
||||
sha256: string,
|
||||
live: () => boolean,
|
||||
): Promise<Step<null>> {
|
||||
const client = getSupabaseClient()
|
||||
if (!client) return fail({ code: 'sheet', kind: 'unavailable' })
|
||||
const fetched = await fetchDrawing(client, { asset_id: assetId, sha256 })
|
||||
if (!live()) return fail({ code: 'stale' })
|
||||
if (!fetched.ok) return fail({ code: 'catalogue', failure: fetched.failure })
|
||||
const held = useEditorStore.getState().addDrawing(fetched.drawing)
|
||||
if (held.ok) return done(null)
|
||||
@@ -193,7 +195,7 @@ export async function uploadDrawing(
|
||||
const stored = await registerAndUpload(sheetId, drawing)
|
||||
if (!live()) return fail({ code: 'stale' })
|
||||
if (!stored.ok) return stored
|
||||
const held = await downloadAndHold(stored.value, drawing.sha256)
|
||||
const held = await downloadAndHold(stored.value, drawing.sha256, live)
|
||||
if (!live()) return fail({ code: 'stale' })
|
||||
return held.ok ? attachToView(viewId, stored.value) : held
|
||||
}
|
||||
@@ -31,7 +31,7 @@ function replacedPatch(
|
||||
documentText: text,
|
||||
previewState: next,
|
||||
handleVersion: state.handleVersion + 1,
|
||||
unsaved: !sameDocument(text, state.savedText),
|
||||
unsaved: state.staleBase || !sameDocument(text, state.savedText),
|
||||
undo: history.undo,
|
||||
redo: history.redo,
|
||||
}
|
||||
|
||||
@@ -164,7 +164,7 @@ export async function submit(api: StoreApi, note?: string): Promise<SubmitOutcom
|
||||
}
|
||||
const reviewId = await submitSheetReview(requireClient(), args)
|
||||
if (api.get().session !== state.session) return blocked('session_changed')
|
||||
api.set({ submitting: false })
|
||||
api.set({ submitting: false, canEdit: false })
|
||||
return { ok: true, reviewId }
|
||||
} catch (error) {
|
||||
return failedSubmit(api, state.session, error)
|
||||
|
||||
@@ -174,7 +174,7 @@ function restoredPatch(
|
||||
next: PreviewState,
|
||||
attached: Attached,
|
||||
): Partial<EditorState> {
|
||||
const text = copyText(copy)
|
||||
const text = JSON.stringify(next.document)
|
||||
return {
|
||||
documentText: text,
|
||||
previewState: next,
|
||||
@@ -183,7 +183,7 @@ function restoredPatch(
|
||||
drawingFailures: { ...now.drawingFailures, ...attached.failures },
|
||||
savedRevision: copy.revision,
|
||||
staleBase: copy.revision < now.savedRevision,
|
||||
unsaved: !sameDocument(text, now.savedText),
|
||||
unsaved: copy.revision < now.savedRevision || !sameDocument(text, now.savedText),
|
||||
...emptyHistory(),
|
||||
...NO_RECOVERY,
|
||||
}
|
||||
|
||||
@@ -1205,8 +1205,8 @@ export const en: Dict = {
|
||||
'editor.draft.status.revision': 'Revision {revision}',
|
||||
'editor.draft.status.unsaved': 'unsaved changes',
|
||||
'editor.draft.status.saving': 'Saving…',
|
||||
'editor.draft.status.copy_quota': "Temporary local copy impossible (this tab's storage is full)",
|
||||
'editor.draft.status.copy_cap': "Temporary local copy impossible: two other drafts already have a copy in this tab",
|
||||
'editor.draft.status.copy_quota': "Temporary local copy impossible (tab full): not saved on the server",
|
||||
'editor.draft.status.copy_cap': "Temporary local copy impossible (two other copies in this tab): not saved on the server",
|
||||
'editor.draft.copy_kept': "A temporary local copy, limited to this tab, is kept; it is not saved on the server.",
|
||||
'editor.draft.copy_not_kept': "No temporary local copy could be written in this tab: these changes are saved nowhere, neither in the tab nor on the server.",
|
||||
'editor.draft.mode.narrow': 'Editing requires a screen at least 1,024 px wide.',
|
||||
@@ -1574,8 +1574,8 @@ export const en: Dict = {
|
||||
'editor.verification.issue.annotation.no_findings': 'This annotation is linked to no findings zone: a click on it will offer nothing.',
|
||||
'editor.verification.issue.annotation.geometry.missing': 'This annotation has no geometry.',
|
||||
'editor.verification.issue.annotation.geometry.out_of_frame': 'This annotation is not entirely inside the frame of its view.',
|
||||
'editor.verification.issue.annotation.geometry.too_small': 'This annotation shows too small on the phone preview.',
|
||||
'editor.verification.issue.annotation.geometry.interior_too_small': 'The inside of this zone is too narrow to tap on the phone preview.',
|
||||
'editor.verification.issue.annotation.geometry.too_small': 'A marker is too small to tap on a phone.',
|
||||
'editor.verification.issue.annotation.geometry.interior_too_small': "A zone's interior is too narrow to tap on a phone.",
|
||||
'editor.verification.issue.region.code.duplicate': 'Two vertebral regions have the same code.',
|
||||
'editor.verification.issue.region.count_range.invalid': 'The usual count of this region is outside the stated variation.',
|
||||
'editor.verification.issue.category.id.duplicate': 'Two annotation categories have the same id.',
|
||||
|
||||
@@ -1236,8 +1236,8 @@ export const fr: Dict = {
|
||||
'editor.draft.status.revision': 'Révision {revision}',
|
||||
'editor.draft.status.unsaved': 'modifications non enregistrées',
|
||||
'editor.draft.status.saving': 'Enregistrement…',
|
||||
'editor.draft.status.copy_quota': "Copie locale temporaire impossible (stockage de l'onglet plein)",
|
||||
'editor.draft.status.copy_cap': "Copie locale temporaire impossible : deux autres brouillons ont déjà une copie dans cet onglet",
|
||||
'editor.draft.status.copy_quota': "Copie locale temporaire impossible (onglet plein) : non enregistré sur le serveur",
|
||||
'editor.draft.status.copy_cap': "Copie locale temporaire impossible (deux autres copies dans cet onglet) : non enregistré sur le serveur",
|
||||
'editor.draft.copy_kept': "Une copie locale temporaire, propre à cet onglet, est conservée ; elle n'est pas enregistrée sur le serveur.",
|
||||
'editor.draft.copy_not_kept': "Aucune copie locale temporaire n'a pu être écrite dans cet onglet : ces modifications ne sont enregistrées nulle part, ni dans l'onglet ni sur le serveur.",
|
||||
'editor.draft.mode.narrow': "L'édition nécessite une largeur d'écran d'au moins 1 024 px.",
|
||||
@@ -1605,8 +1605,8 @@ export const fr: Dict = {
|
||||
'editor.verification.issue.annotation.no_findings': "Cette annotation n'est liée à aucune zone de constats : un clic dessus ne proposera rien.",
|
||||
'editor.verification.issue.annotation.geometry.missing': "Cette annotation n'a pas de géométrie.",
|
||||
'editor.verification.issue.annotation.geometry.out_of_frame': "Cette annotation n'est pas entièrement dans le cadre de sa vue.",
|
||||
'editor.verification.issue.annotation.geometry.too_small': "Cette annotation s'affiche trop petite sur l'aperçu téléphone.",
|
||||
'editor.verification.issue.annotation.geometry.interior_too_small': "L'intérieur de cette zone est trop étroit pour être touché sur l'aperçu téléphone.",
|
||||
'editor.verification.issue.annotation.geometry.too_small': "Un repère est trop petit pour être touché sur mobile.",
|
||||
'editor.verification.issue.annotation.geometry.interior_too_small': "L'intérieur d'une zone est trop étroit pour être touché sur mobile.",
|
||||
'editor.verification.issue.region.code.duplicate': 'Deux régions vertébrales ont le même code.',
|
||||
'editor.verification.issue.region.count_range.invalid': "Le nombre habituel de cette région n'est pas dans la variation indiquée.",
|
||||
'editor.verification.issue.category.id.duplicate': "Deux catégories d'annotation ont le même identifiant.",
|
||||
|
||||
@@ -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',
|
||||
|
||||
@@ -147,6 +147,30 @@ describe('restore', () => {
|
||||
expect(store.getState().conflict).toMatchObject({ status: 'known', revision: 5 })
|
||||
})
|
||||
|
||||
it('stays unsaved under staleBase when edited back to the server text (no dead end)', async () => {
|
||||
seed(movedText(10), 2)
|
||||
await openReady({ revision: 5 })
|
||||
await store.getState().restoreCopy()
|
||||
expect(commitMove(50)).toMatchObject({ ok: true })
|
||||
expect(store.getState().documentText).toBe(store.getState().savedText)
|
||||
expect(store.getState()).toMatchObject({ staleBase: true, unsaved: true })
|
||||
})
|
||||
|
||||
it('a restored copy holding bare nodes takes the core defaults-filled document', async () => {
|
||||
const bare = JSON.parse(baseText())
|
||||
bare.finding_zones = [
|
||||
{
|
||||
id: 'z', name: { fr: 'Z', en: 'Z' },
|
||||
categories: [{ id: 'c', kind: 'dysfunction', name: { fr: 'C', en: 'C' }, children: [{ id: 'n', name: { fr: 'N', en: 'N' } }] }],
|
||||
},
|
||||
]
|
||||
seed(JSON.stringify(bare), 3)
|
||||
await openReady({ revision: 3 })
|
||||
await store.getState().restoreCopy()
|
||||
const node = JSON.parse(store.getState().documentText).finding_zones[0].categories[0].children[0]
|
||||
expect(node).toMatchObject({ reference_ids: [], children: [], review_status: 'inherited' })
|
||||
})
|
||||
|
||||
it('takes the reload path for « Annuler les modifications » under staleBase', async () => {
|
||||
seed(movedText(10), 2)
|
||||
await openReady({ revision: 5 })
|
||||
|
||||
@@ -334,6 +334,8 @@ describe('discard and submit', () => {
|
||||
sb.submitSheetReview.mockResolvedValue('review-1' as never)
|
||||
expect(await store.getState().submit()).toEqual({ ok: true, reviewId: 'review-1' })
|
||||
expect(sb.submitSheetReview).toHaveBeenCalledWith(expect.anything(), { version_id: VERSION, expected_revision: 3 })
|
||||
// The accepted submission froze the store; a fresh session meets the conflict.
|
||||
await openReady({ revision: 3 })
|
||||
sb.submitSheetReview.mockRejectedValue(new SheetFailure('draft_conflict'))
|
||||
sb.getOfficialSheetAdmin.mockRejectedValue(new SheetFailure('network'))
|
||||
expect(await store.getState().submit()).toMatchObject({ kind: 'draft_conflict' })
|
||||
@@ -342,6 +344,16 @@ describe('discard and submit', () => {
|
||||
})
|
||||
})
|
||||
|
||||
describe('after the server accepted the submission', () => {
|
||||
it('takes no further change before the sheet reload turns the draft frozen', async () => {
|
||||
await openReady({ revision: 3 })
|
||||
sb.submitSheetReview.mockResolvedValue('review-1' as never)
|
||||
expect(await store.getState().submit()).toMatchObject({ ok: true })
|
||||
expect(commitMove(40)).toMatchObject({ ok: false, reason: 'blocked', kind: 'read_only' })
|
||||
expect(store.getState().unsaved).toBe(false)
|
||||
})
|
||||
})
|
||||
|
||||
describe('guards', () => {
|
||||
it('refuses a submit while the document differs from the saved text', async () => {
|
||||
await openReady()
|
||||
|
||||
@@ -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)
|
||||
})
|
||||
})
|
||||
Reference in new issue
Block a user