feat(map): add protected operations access
This commit is contained in:
@@ -80,6 +80,29 @@ assert.equal(points.length, 2);
|
||||
assert.ok(points.every(node => node.kind === 'vehiclePoint'));
|
||||
assert.equal(points.find(node => node.nameZh === '粤A00001').online, 1);
|
||||
|
||||
// A selected district is a semantic filter, not a viewport filter. Its full
|
||||
// fleet must survive a camera fit even when a valid vehicle sits outside the
|
||||
// initial district-centroid viewport.
|
||||
currentMode = 'vehicle';
|
||||
dashboard = {
|
||||
vehicles: [
|
||||
{ vin: 'VIN-BY-1', plateNumber: '粤A10001', activeToday: true, locationAvailable: true, longitude: 113.22, latitude: 23.18 },
|
||||
{ vin: 'VIN-BY-2', plateNumber: '粤A10002', activeToday: true, locationAvailable: true, longitude: 113.41, latitude: 23.38 }
|
||||
]
|
||||
};
|
||||
vehicleFilterGroups.districts = [{ adcode: '440111', vehicles: dashboard.vehicles }];
|
||||
filterState.district = '440111';
|
||||
map = {
|
||||
getZoom: () => 11.6,
|
||||
getBounds: () => ({
|
||||
getSouthWest: () => ({ getLng: () => 113.1, getLat: () => 23.1 }),
|
||||
getNorthEast: () => ({ getLng: () => 113.3, getLat: () => 23.3 })
|
||||
})
|
||||
};
|
||||
assert.equal(hierarchyLevelForZoom(), 'vehicle');
|
||||
assert.equal(vehiclePointNodes().length, 2);
|
||||
filterState.district = '';
|
||||
|
||||
dashboard = {
|
||||
stations: [
|
||||
{ id: 'GD-1', name: '广州合作站', province: '广东省', city: '广州市', address: '广东省广州市黄埔区开源大道1号', longitude: 113.2, latitude: 23.1, cooperative: true, totalHydrogenKg: 20 },
|
||||
@@ -110,6 +133,11 @@ map = {
|
||||
assert.equal(stationNodes(false).length, 3);
|
||||
assert.equal(stationNodes(true).length, 2);
|
||||
assert.deepEqual(stationNodes(true).map(node => node.name).sort(), ['佛山外部站', '广州合作站']);
|
||||
const stationNavigationUrl = navigationUrlForEntity('station', dashboard.stations[0]);
|
||||
assert.ok(stationNavigationUrl.startsWith('https://uri.amap.com/navigation?to=113.200000,23.100000,'));
|
||||
assert.match(stationNavigationUrl, /%E5%B9%BF%E5%B7%9E/);
|
||||
assert.match(stationNavigationUrl, /coordinate=gaode&callnative=1$/);
|
||||
assert.equal(navigationUrlForEntity('vehicle', { plateNumber: '无位置车辆' }), null);
|
||||
const stationView = stationViewportSummary();
|
||||
assert.equal(stationView.level, 'station');
|
||||
assert.equal(stationView.visibleNodes.length, 2);
|
||||
|
||||
Reference in New Issue
Block a user