refactor: isolate camera panel controls and presentation

This commit is contained in:
Sameh Khamis committed 2026-09-13 00:38:01 -07:00
1 parent bd14d6c301
commit f45f399c31
17 files changed
+932 -657

No files matched your search

+22
View File
@@ -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'\)/);
});