- commit
- 55cd31ab6802c8097bf87cdb4e9997fdfbcb73f2
- parent
- a5711fe70f587466842bfe39810dab914348435c
- author
- Dami <dami.etoile@gmail.com>
| M | src/ | 6 | +++--- |
| M | tests/ | 8 | ++++++++ |
@@ -113,7 +113,7 @@ export function createInput(options = {}) {
113113 if (typeof dirOrIntent === 'string') {114114 if (DIRECTIONS[dirOrIntent]) return pressDirection(dirOrIntent, source, `${source}:${dirOrIntent}`, time);115115 if (dirOrIntent === 'undo') return pressUndo(source, source, time);116- if (['confirm', 'restart', 'menu', 'mute'].includes(dirOrIntent)) { emit({ type: dirOrIntent, source }); return true; }116+ if (['confirm', 'restart', 'menu', 'mute', 'summary'].includes(dirOrIntent)) { emit({ type: dirOrIntent, source }); return true; }117117 return false;118118 }119119 if (!dirOrIntent || typeof dirOrIntent !== 'object') return false;@@ -127,7 +127,7 @@ export function createInput(options = {}) {
127127 }128128 function pressAction(type, source = 'gamepad', time = now()) {129129 if (type === 'undo') return pressUndo(source, source, time);130- if (['confirm', 'restart', 'menu', 'mute'].includes(type)) { emit({ type, source }); return true; }130+ if (['confirm', 'restart', 'menu', 'mute', 'summary'].includes(type)) { emit({ type, source }); return true; }131131 return false;132132 }133133 function releaseAction(type, source = 'gamepad') {@@ -148,7 +148,7 @@ export function createInput(options = {}) {
148148 if (!event.repeat) pressUndo('keyboard', `keyboard:${key}`);149149 return;150150 }151- const action = ({ Enter: 'confirm', Escape: 'menu', p: 'menu', P: 'menu', r: 'restart', R: 'restart', m: 'mute', M: 'mute' })[key];151+ const action = ({ Enter: 'confirm', Escape: 'menu', p: 'menu', P: 'menu', r: 'restart', R: 'restart', m: 'mute', M: 'mute', t: 'summary', T: 'summary' })[key];152152 if (action) { event.preventDefault?.(); if (!event.repeat) emit({ type: action, source: 'keyboard' }); }153153 }154154 function handleKeyUp(event) {@@ -93,3 +93,11 @@ test('touch swipes move while taps confirm', () => {
9393 h.input.pointerUp({ pointerId: 3, pointerType: 'touch', clientX: 30, clientY: 67, preventDefault() {} });9494 assert.equal(h.intents.at(-1).dir, 'down');9595 });96+97+test('T requests an accessible board summary without moving the game', () => {98+ const h = harness();99+ h.target.dispatch('keydown', { key: 't', repeat: false });100+ assert.equal(h.intents.at(-1).type, 'summary');101+ h.target.dispatch('keydown', { key: 'T', repeat: false });102+ assert.equal(h.intents.at(-1).type, 'summary');103+});