test(editor): reference dialog, filter and the owner journey, specs follow the dialog
This commit is contained in:
1 parent
7a64daf251
commit
8b42816270
20 files changed
+1546
-1171
No files matched your search
@@ -147,16 +147,69 @@ describe('navigationReducer', () => {
|
||||
const state = run(
|
||||
initialNavigation('findings'),
|
||||
{ type: 'open_citations', citedBy: node },
|
||||
{ type: 'show_all_references' },
|
||||
{ type: 'show_all_references', filter: node },
|
||||
)
|
||||
expect(state).toMatchObject({
|
||||
tab: 'references',
|
||||
finding: null,
|
||||
referenceFilter: node,
|
||||
libraryReset: 1,
|
||||
focus: undefined,
|
||||
})
|
||||
expect(state.visitedTabs).toEqual(['findings', 'references'])
|
||||
expect(run(state, { type: 'show_all_references' }).libraryReset).toBe(2)
|
||||
const again = run(state, { type: 'show_all_references', filter: node })
|
||||
expect(again.libraryReset).toBe(2)
|
||||
})
|
||||
|
||||
it('the reference dialog is a layer above the place and the sheet', () => {
|
||||
const open = run(
|
||||
initialNavigation('findings'),
|
||||
{ type: 'open_citations', citedBy: node },
|
||||
{ type: 'open_reference', id: 'ref-a' },
|
||||
)
|
||||
expect(open).toMatchObject({
|
||||
tab: 'findings',
|
||||
finding: { key: node, citations: true },
|
||||
reference: { edit: 'ref-a' },
|
||||
})
|
||||
expect(run(open, { type: 'close_reference' }).reference).toBeNull()
|
||||
const created = run(initialNavigation('general'), {
|
||||
type: 'create_reference',
|
||||
})
|
||||
expect(created).toMatchObject({
|
||||
tab: 'references',
|
||||
reference: { create: true },
|
||||
})
|
||||
})
|
||||
|
||||
it('the filter belongs to the References tab: any move to another tab drops it', () => {
|
||||
const filtered = run(initialNavigation('findings'), {
|
||||
type: 'show_all_references',
|
||||
filter: node,
|
||||
})
|
||||
expect(
|
||||
run(filtered, { type: 'select_tab', tab: 'references' }),
|
||||
).toMatchObject({
|
||||
referenceFilter: node,
|
||||
})
|
||||
expect(run(filtered, { type: 'select_tab', tab: 'general' })).toMatchObject(
|
||||
{
|
||||
referenceFilter: null,
|
||||
},
|
||||
)
|
||||
expect(run(filtered, { type: 'open_finding', key: node })).toMatchObject({
|
||||
tab: 'findings',
|
||||
referenceFilter: null,
|
||||
finding: { key: node, citations: false },
|
||||
})
|
||||
const toReference = run(filtered, {
|
||||
type: 'go_to',
|
||||
target: targetOfKey({ kind: 'reference', id: 'x' }),
|
||||
})
|
||||
expect(toReference.referenceFilter).toBeNull()
|
||||
expect(
|
||||
run(filtered, { type: 'clear_reference_filter' }).referenceFilter,
|
||||
).toBeNull()
|
||||
})
|
||||
|
||||
it('a plain go_to a reference leaves the library reset alone', () => {
|
||||
|
||||
Reference in new issue
Block a user