fix(editor): load the core's defaults-filled document, trial guide fixes
This commit is contained in:
1 parent
0d167df271
commit
bb99edd2dd
5 files changed
+48
-54
No files matched your search
@@ -96,28 +96,34 @@ describe('findings tree model', () => {
|
||||
expect(shown.map((i) => i.kind)).toEqual(['zone', 'category', 'zone'])
|
||||
})
|
||||
|
||||
it('reads nodes that omit their defaulted fields (the equine import)', () => {
|
||||
it('loads a stored draft whose nodes omit defaulted fields, filled and clean', async () => {
|
||||
const stored = JSON.parse(baseText()) as Record<string, unknown>
|
||||
const bare = {
|
||||
id: 'n1',
|
||||
name: name('N1'),
|
||||
children: [{ id: 'n2', name: name('N2') }],
|
||||
}
|
||||
const stored = {
|
||||
finding_zones: [
|
||||
{
|
||||
id: 'z',
|
||||
name: name('Z'),
|
||||
categories: [
|
||||
{ id: 'c', kind: 'dysfunction', name: name('C'), children: [bare] },
|
||||
],
|
||||
},
|
||||
],
|
||||
} as unknown as AnatomicalSheetDocument
|
||||
const all = buildItems(stored)
|
||||
expect(all.map((i) => i.level)).toEqual([1, 2, 3, 4])
|
||||
expect(all[3].element).toMatchObject({
|
||||
value: { reference_ids: [], children: [], review_status: 'inherited' },
|
||||
stored.finding_zones = [
|
||||
{
|
||||
id: 'z',
|
||||
name: name('Z'),
|
||||
categories: [
|
||||
{ id: 'c', kind: 'dysfunction', name: name('C'), children: [bare] },
|
||||
],
|
||||
},
|
||||
]
|
||||
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: [],
|
||||
children: [],
|
||||
review_status: 'inherited',
|
||||
})
|
||||
render(<FindingsTab {...props} />)
|
||||
expect(screen.getAllByRole('treeitem').length).toBeGreaterThan(0)
|
||||
})
|
||||
|
||||
it('maps the WAI-ARIA keys', async () => {
|
||||
|
||||
Reference in new issue
Block a user