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
@@ -131,19 +131,23 @@ describe('the guard stack', () => {
|
||||
const { result } = renderHook(() => useEditorNavigation('general'))
|
||||
const { guards } = result.current
|
||||
const order: string[] = []
|
||||
guards.register('citations', () => {
|
||||
order.push('citations')
|
||||
guards.register('reference', () => {
|
||||
order.push('reference')
|
||||
return { allowed: true, note: 'a' }
|
||||
})
|
||||
guards.register('finding', () => {
|
||||
order.push('finding')
|
||||
return { allowed: false, note: 'b' }
|
||||
})
|
||||
expect(guards.ask('reference', false)).toEqual({ allowed: true })
|
||||
expect(guards.ask('reference', false)).toEqual({
|
||||
allowed: true,
|
||||
note: 'a',
|
||||
})
|
||||
expect(guards.ask('finding', true).allowed).toBe(false)
|
||||
order.length = 0
|
||||
expect(guards.askAll(false)).toEqual({ allowed: false, note: 'b. a' })
|
||||
expect(order).toEqual(['finding', 'citations'])
|
||||
// The reference dialog is the top layer: it is asked first.
|
||||
expect(guards.askAll(false)).toEqual({ allowed: false, note: 'a. b' })
|
||||
expect(order).toEqual(['reference', 'finding'])
|
||||
guards.register('finding', null)
|
||||
expect(guards.askAll(false).allowed).toBe(true)
|
||||
})
|
||||
|
||||
Reference in new issue
Block a user