|
|
@@ -903,6 +903,29 @@ describe('arbitrate', () => {
|
|
|
controller.track('/g', 2, { tier: 'plain' }, 1)
|
|
|
expect(controller.arbitrate('enter', false)).toBe('pass')
|
|
|
})
|
|
|
+
|
|
|
+ it('enter during a pending refinement is consumed: no pick, no submit fallthrough', async () => {
|
|
|
+ const picks: string[] = []
|
|
|
+ const cmd = deferredSource('/', 'command', {
|
|
|
+ onPick: (pick) => { picks.push(pick.candidate.name); return undefined },
|
|
|
+ })
|
|
|
+ const { controller } = controllerBench([cmd.source])
|
|
|
+ controller.track('/g', 2, { tier: 'plain' }, 1)
|
|
|
+ cmd.pending[0]!.resolve([{ name: 'goal' }, { name: 'plan' }])
|
|
|
+ await tick()
|
|
|
+ expect(controller.menu.getSnapshot().highlight).toEqual({ source: 'command', index: 0 })
|
|
|
+ // Refinement: previous rows and highlight stay visible while the fetch pends.
|
|
|
+ controller.track('/go', 3, { tier: 'plain' }, 2)
|
|
|
+ expect(controller.menu.getSnapshot().highlight).toEqual({ source: 'command', index: 0 })
|
|
|
+ expect(controller.arbitrate('enter', false)).toBe('consumed')
|
|
|
+ expect(picks).toHaveLength(0)
|
|
|
+ expect(controller.menu.getSnapshot().open).toBe(true)
|
|
|
+ // Settled: the same gesture picks again.
|
|
|
+ cmd.pending[1]!.resolve([{ name: 'goal' }])
|
|
|
+ await tick()
|
|
|
+ expect(controller.arbitrate('enter', false)).toBe('pick-highlighted')
|
|
|
+ expect(picks).toEqual(['goal'])
|
|
|
+ })
|
|
|
})
|
|
|
|
|
|
describe('onSpace', () => {
|