refactor(map): remove access gate

This commit is contained in:
lingniu
2026-08-11 19:24:32 +08:00
parent d1ba129e99
commit 357dd490e9
9 changed files with 140 additions and 580 deletions
+18
View File
@@ -138,6 +138,22 @@ assert.ok(stationNavigationUrl.startsWith('https://uri.amap.com/navigation?to=11
assert.match(stationNavigationUrl, /%E5%B9%BF%E5%B7%9E/);
assert.match(stationNavigationUrl, /coordinate=gaode&callnative=1$/);
assert.equal(navigationUrlForEntity('vehicle', { plateNumber: '无位置车辆' }), null);
const launchClassSet = new Set();
const launchOverlay = { hidden: true, classList: { add(name) { launchClassSet.add(name); }, remove(name) { launchClassSet.delete(name); } } };
const launchButton = { disabled: false, dataset: { navigationUrl: stationNavigationUrl }, classList: { add(name) { launchClassSet.add('button:' + name); }, remove(name) { launchClassSet.delete('button:' + name); }, contains(name) { return launchClassSet.has('button:' + name); } } };
const launchTimers = [];
document.getElementById = id => id === 'navigationLaunchOverlay' ? launchOverlay : id === 'detailNavigateBtn' ? launchButton : null;
window.requestAnimationFrame = callback => callback();
window.setTimeout = (callback, delay) => { launchTimers.push({ callback, delay }); return launchTimers.length; };
window.clearTimeout = () => {};
window.location = { assign() {} };
selectedEntity = { mode: 'station', entity: dashboard.stations[0] };
navigateToSelectedEntity();
assert.equal(launchOverlay.hidden, false);
assert.ok(launchClassSet.has('is-visible'));
assert.ok(launchClassSet.has('button:is-launching'));
assert.equal(launchButton.disabled, true);
assert.deepEqual(launchTimers.map(timer => timer.delay), [140, 4000]);
const stationView = stationViewportSummary();
assert.equal(stationView.level, 'station');
assert.equal(stationView.visibleNodes.length, 2);
@@ -170,5 +186,7 @@ const sandbox = {
setInterval() {},
clearInterval() {}
};
assert.match(source, /navigationLaunchOverlay/);
assert.match(source, /正在打开高德地图/);
vm.runInNewContext(`${source}\n${checks}`, sandbox, { filename: 'app.js' });
console.log('vehicle hierarchy aggregation tests: ok');