test(editor): lot K review fixes, filled-document save proof
This commit is contained in:
1 parent
bb99edd2dd
commit
4cc27a8231
10 files changed
+132
-32
No files matched your search
@@ -13,6 +13,7 @@ import { edit, insert } from '../helpers/editorFixtures'
|
||||
import {
|
||||
baseText,
|
||||
openReady,
|
||||
serverHas,
|
||||
resetStore,
|
||||
store,
|
||||
} from '../helpers/editorHarness'
|
||||
@@ -113,9 +114,6 @@ describe('findings tree model', () => {
|
||||
},
|
||||
]
|
||||
await openReady({ text: JSON.stringify(stored) })
|
||||
const { documentText, savedText, unsaved } = store.getState()
|
||||
expect(unsaved).toBe(false)
|
||||
expect(documentText).toBe(savedText)
|
||||
const n2 = doc().finding_zones[0].categories[0].children[0].children[0]
|
||||
expect(n2).toMatchObject({
|
||||
reference_ids: [],
|
||||
@@ -126,6 +124,40 @@ describe('findings tree model', () => {
|
||||
expect(screen.getAllByRole('treeitem').length).toBeGreaterThan(0)
|
||||
})
|
||||
|
||||
it('a reload that brings bare nodes keeps the filled text, not dirty', async () => {
|
||||
await openReady()
|
||||
const stored = JSON.parse(baseText()) as Record<string, unknown>
|
||||
stored.finding_zones = [
|
||||
{
|
||||
id: 'z',
|
||||
name: name('Z'),
|
||||
categories: [
|
||||
{
|
||||
id: 'c',
|
||||
kind: 'dysfunction',
|
||||
name: name('C'),
|
||||
children: [{ id: 'n1', name: name('N1') }],
|
||||
},
|
||||
],
|
||||
},
|
||||
]
|
||||
serverHas(JSON.stringify(stored), 7)
|
||||
expect(
|
||||
await store.getState().reloadServerDraft({ confirmed: true }),
|
||||
).toEqual({
|
||||
ok: true,
|
||||
})
|
||||
const state = store.getState()
|
||||
expect(state.unsaved).toBe(false)
|
||||
expect(state.savedText).toBe(state.documentText)
|
||||
expect(state.savedRevision).toBe(7)
|
||||
expect(doc().finding_zones[0].categories[0].children[0]).toMatchObject({
|
||||
reference_ids: [],
|
||||
children: [],
|
||||
review_status: 'inherited',
|
||||
})
|
||||
})
|
||||
|
||||
it('maps the WAI-ARIA keys', async () => {
|
||||
await openReady({ text: treeText() })
|
||||
const all = buildItems(doc())
|
||||
|
||||
Reference in new issue
Block a user