mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-05 10:53:59 +00:00
refactor: separate application UI state owners
This commit is contained in:
1 parent
ddc1edf3af
commit
dc81cf585c
34 files changed
+3378
-2201
No files matched your search
@@ -1,3 +1,5 @@
|
||||
import { VisualSettings } from './ui/visualSettings.js';
|
||||
import { readShellSource, shellMethod } from './testSupport/readShellSource.mjs';
|
||||
import { StyleManager } from './ui/applicationShell.js';
|
||||
import { _claimContextVisualAuthority, setContextMode } from './ui/contextActions.js';
|
||||
import { _initGlobalContextPanel } from './ui/contextBindings.js';
|
||||
@@ -7,11 +9,11 @@ import fs from 'node:fs';
|
||||
import { ShareLinkManager, decodeShareCreatedAtMs } from './sharelink.js';
|
||||
import { createDefaultLayerState } from './data/layerState.js';
|
||||
|
||||
const uiSource = fs.readFileSync(new URL('./ui/applicationShell.js', import.meta.url), 'utf8');
|
||||
const uiSource = readShellSource();
|
||||
|
||||
function sourceBlock(start, end) {
|
||||
const name = start.trim().match(/^(?:async )?(\w+)\(/)?.[1];
|
||||
if (typeof StyleManager.prototype[name] === 'function') return StyleManager.prototype[name].toString();
|
||||
if (typeof shellMethod(name) === 'function') return shellMethod(name).toString();
|
||||
const startIndex = uiSource.indexOf(start);
|
||||
const endIndex = uiSource.indexOf(end, startIndex + start.length);
|
||||
assert.ok(startIndex >= 0, `missing source block start: ${start}`);
|
||||
@@ -189,7 +191,7 @@ test('incoming state suppresses premature hash replacement until restoration', (
|
||||
test('a shared view reserves its own camera without cancelling its saved Follow', () => {
|
||||
assert.match(
|
||||
uiSource,
|
||||
/_beginDeferredNavigation\(\s*'shared view',\s*\{ cancelPendingSelection: false \},\s*\)/,
|
||||
/_beginDeferredNavigation\(\s*'shared view',\s*\{\s*cancelPendingSelection: false,?\s*\},?\s*\)/,
|
||||
);
|
||||
const deferred = sourceBlock(
|
||||
" _beginDeferredNavigation(noun = 'location', { cancelPendingSelection = true } = {}) {",
|
||||
@@ -693,11 +695,12 @@ test('visual input listeners are revoked before asynchronous UI teardown', () =>
|
||||
assert.ok(firstAwait > 0);
|
||||
const synchronous = disposal.slice(0, firstAwait);
|
||||
assert.match(synchronous, /this\._applicationShortcuts\?\.destroy\(\)/);
|
||||
assert.match(synchronous, /this\._visualEffects\.stop\(\)/);
|
||||
assert.match(synchronous, /this\._visualSettings\.stop\(\)/);
|
||||
assert.match(synchronous, /this\._mapSourceControls\?\.destroy\(\)/);
|
||||
assert.match(synchronous, /this\._clearLayersControl\?\.destroy\(\)/);
|
||||
assert.match(synchronous, /this\._locationControls\?\.destroy\(\)/);
|
||||
assert.match(synchronous, /this\._locationLookup\?\.destroy\(\)/);
|
||||
assert.match(synchronous, /this\._displayControls\?\.destroy\(\)/);
|
||||
assert.match(synchronous, /this\._styleParameters\?\.destroy\(\)/);
|
||||
assert.match(VisualSettings.prototype.stop.toString(), /this\._styleParameters\?\.destroy\(\)/);
|
||||
assert.match(VisualSettings.prototype.stop.toString(), /this\._visualEffects\.stop\(\)/);
|
||||
});
|
||||
Reference in new issue
Block a user