mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-05 02:44:02 +00:00
refactor: isolate camera panel controls and presentation
This commit is contained in:
1 parent
bd14d6c301
commit
f45f399c31
17 files changed
+932
-657
No files matched your search
@@ -95,3 +95,25 @@ test('CCTV disable transition does not emit enable-ownership diagnostics', async
|
||||
assert.deepEqual(transitions, [false]);
|
||||
assert.deepEqual(diagnostics, []);
|
||||
});
|
||||
|
||||
|
||||
test('a disposed UI cannot activate a camera when enabling finishes late', async () => {
|
||||
let release;
|
||||
let disposed = false;
|
||||
let activations = 0;
|
||||
const pending = runCctvLayerEnableTransition({
|
||||
target: true,
|
||||
setEnabled: () => new Promise((resolve) => { release = resolve; }),
|
||||
readOwnership: () => ({}),
|
||||
shouldFocus: () => !disposed,
|
||||
activate: () => { activations++; return 'camera-a'; },
|
||||
fly: () => assert.fail('disposed UI must not fly'),
|
||||
debug: () => {},
|
||||
});
|
||||
disposed = true;
|
||||
release();
|
||||
await pending;
|
||||
assert.equal(activations, 0);
|
||||
const uiSource = readFileSync(new URL('./ui.js', import.meta.url), 'utf8');
|
||||
assert.match(uiSource, /shouldFocus: \(\) => !this\._disposed && this\._dataManager\.isEnabled\('cctv'\)/);
|
||||
});
|
||||
Reference in new issue
Block a user