mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-15 07:42:23 +00:00
fix(cockpit): C stays the CCTV shortcut when the bridge cannot be entered
With a vessel selected and no aircraft tracked, Cockpit took C and stopped it even when the bridge gate was shut, so the key did nothing and CCTV no longer toggled. C is now taken only when the bridge can be entered. The arrow keys also stay with comboboxes, spinbuttons, trees, grids, menubars, scrollbars and text boxes on a bridge, which move with them.
This commit is contained in:
1 parent
d55acd2ac5
commit
b98bc4b0dc
2 files changed
+40
-3
No files matched your search
@@ -439,6 +439,27 @@ test('C enters the selected vessel bridge and aircraft-only entry refuses it', a
|
||||
assert.equal(event.defaultPrevented, true);
|
||||
});
|
||||
|
||||
test('C stays the CCTV shortcut when the bridge gate is shut', async (t) => {
|
||||
const { cockpit } = fixture(t, { bridgeAllowed: false });
|
||||
let stopped = false;
|
||||
const event = {
|
||||
key: 'c',
|
||||
target: document.body,
|
||||
defaultPrevented: false,
|
||||
preventDefault() {
|
||||
this.defaultPrevented = true;
|
||||
},
|
||||
stopImmediatePropagation() {
|
||||
stopped = true;
|
||||
},
|
||||
};
|
||||
cockpit.onKeyDown(event);
|
||||
await settle();
|
||||
assert.equal(cockpit.active, false);
|
||||
assert.equal(event.defaultPrevented, false);
|
||||
assert.equal(stopped, false, 'the application shortcut still sees C');
|
||||
});
|
||||
|
||||
test('a slow-frame bridge keeps pace with its ship', async (t) => {
|
||||
// One rendered frame a second, as software rendering manages. The bridge
|
||||
// must still cover the ship's distance, not a capped fraction of it.
|
||||
|
||||
Reference in new issue
Block a user