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
@@ -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 })
|
||||
|
||||
Reference in new issue
Block a user