Keyboard shortcuts: the Help button works on the title screen; MCP knows the new actions
Before a game starts the click handler only runs allowlisted actions, so Help's Keyboard shortcuts button did nothing on the title screen. Allow it, and close the list with helpClose, so ? returns to the title instead of leaving an empty map. popStep, zoomStep and keys are views for the MCP server.
This commit is contained in:
parent
9cf90d0ad0
commit
48ba0048da
4 changed files with 18 additions and 2 deletions
|
|
@ -106,3 +106,16 @@ test('the shortcut list in German', () => {
|
|||
assert.match(txt, /Leertaste/);
|
||||
assert.deepEqual(errors, []);
|
||||
});
|
||||
|
||||
test('on the title screen, Help opens the shortcut list and both ways out lead back to the title', () => {
|
||||
const { ev, dom, errors } = load();
|
||||
const doc = dom.window.document, key = keyer(dom), title = () => !ev("$('modal').hidden") && ev("$('modal').className") !== 'keys';
|
||||
assert.ok(ev('!S'), 'no game yet');
|
||||
ev('ACT.help()');
|
||||
doc.querySelector('#modalCard [data-act="keys"]').click();
|
||||
assert.equal(ev("$('modal').className"), 'keys', 'the button works before a game starts');
|
||||
key('?'); assert.ok(title(), '? goes back to the title, not to an empty map');
|
||||
ev('ACT.help()'); doc.querySelector('#modalCard [data-act="keys"]').click();
|
||||
doc.querySelector('#modalCard .btns [data-act="helpClose"]').click(); assert.ok(title(), 'and so does its button');
|
||||
assert.deepEqual(errors, []);
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue