From c5fd050438ff77d0bacb1db9f1e9de2f82f77d90 Mon Sep 17 00:00:00 2001 From: Cursor Agent Date: Thu, 24 Sep 2026 06:33:41 +0000 Subject: [PATCH] chore(core): cover default spatial keynav constructor options Adds a unit test for constructing KeyNavigationSpatialController without options, covering the default isEnabled path. Signed-off-by: Cursor Agent --- .../keynav-spatial.controller.test.ts | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/projects/core/src/internal/controllers/keynav-spatial.controller.test.ts b/projects/core/src/internal/controllers/keynav-spatial.controller.test.ts index 0ccc35fcf..6e81c0e28 100644 --- a/projects/core/src/internal/controllers/keynav-spatial.controller.test.ts +++ b/projects/core/src/internal/controllers/keynav-spatial.controller.test.ts @@ -116,6 +116,26 @@ describe('KeyNavigationSpatialController', () => { expect(events).toEqual([]); }); + it('dispatches spatial commands when constructed without options', () => { + const defaultHost = document.createElement(tag) as KeyNavigationSpatialControllerTestHost; + const defaultEvents: CustomEvent[] = []; + new KeyNavigationSpatialController(defaultHost); + defaultHost.addEventListener('nve-key', event => defaultEvents.push(event as CustomEvent)); + fixture.append(defaultHost); + + defaultHost.dispatchEvent(new KeyboardEvent('keydown', { cancelable: true, key: 'ArrowRight' })); + + expect(defaultEvents).toHaveLength(1); + expect(defaultEvents[0]?.detail).toMatchObject({ + ctrlKey: false, + horizontal: 1, + key: 'ArrowRight', + kind: 'direction', + shiftKey: false, + vertical: 0 + }); + }); + it('removes its listener when the host disconnects', () => { host.remove(); host.dispatchEvent(new KeyboardEvent('keydown', { cancelable: true, key: 'ArrowRight' }));