fix(editor): forget the citing form on Back, refuse sparse paths
This commit is contained in:
1 parent
7a5684aace
commit
6c0f913104
5 files changed
+30
-3
No files matched your search
@@ -181,6 +181,17 @@ describe('a creation started over the citations dialog', () => {
|
||||
expect(cite).not.toHaveBeenCalled()
|
||||
})
|
||||
|
||||
it('a Back that removes the creation dialog forgets its citing form', async () => {
|
||||
cited()
|
||||
const cite = vi.fn()
|
||||
act(() => nav.references.start(null, cite))
|
||||
act(() => navigate(-1))
|
||||
expect(nav.state.reference).toBeNull()
|
||||
await act(async () => nav.references.created('ref-z'))
|
||||
expect(cite).not.toHaveBeenCalled()
|
||||
expect(nav.references.added).toMatchObject({ id: 'ref-z' })
|
||||
})
|
||||
|
||||
it('a later creation from the library sets the notice, cites nothing', async () => {
|
||||
cited()
|
||||
const cite = vi.fn()
|
||||
|
||||
@@ -412,4 +412,11 @@ describe('final review: read-back values are capped', () => {
|
||||
const sheet = { ...edit, finding: { key: node, citations: true } }
|
||||
expect(sanitizeView(sheet)?.reference).toBeNull()
|
||||
})
|
||||
|
||||
it('drops a key whose path is a sparse array', () => {
|
||||
const path: string[] = []
|
||||
path[1] = 'n'
|
||||
const sparse: ElementKey = { kind: 'finding', zone_id: 'z', path }
|
||||
expect(sanitizeView(onFindings(sparse))?.finding).toBeNull()
|
||||
})
|
||||
})
|
||||
Reference in new issue
Block a user