功能:完善车辆地图合作站信息与缓存刷新
This commit is contained in:
@@ -105,13 +105,15 @@ filterState.district = '';
|
||||
|
||||
dashboard = {
|
||||
stations: [
|
||||
{ id: 'GD-1', name: '广州合作站', province: '广东省', city: '广州市', address: '广东省广州市黄埔区开源大道1号', longitude: 113.2, latitude: 23.1, cooperative: true, totalHydrogenKg: 20 },
|
||||
{ id: 'GD-1', name: '广州合作站', province: '广东省', city: '广州市', address: '广东省广州市黄埔区开源大道1号', longitude: 113.2, latitude: 23.1, cooperative: true, contactPerson: '张工', contactPhone: '13800000000', unitPrice: 12.5, totalHydrogenKg: 20 },
|
||||
{ id: 'GD-2', name: '佛山外部站', province: '广东省', city: '佛山市', longitude: 113.1, latitude: 23.0, cooperative: false, totalHydrogenKg: 10 },
|
||||
{ id: 'ZJ-1', name: '嘉兴合作站', province: '浙江省', city: '嘉兴市', longitude: 120.7, latitude: 30.7, cooperative: true, totalHydrogenKg: 30 }
|
||||
]
|
||||
};
|
||||
currentMode = 'station';
|
||||
assert.equal(stationDistrictName(dashboard.stations[0]), '黄埔区');
|
||||
assert.equal(stationUnitPrice(dashboard.stations[0]), '¥12.50 / kg');
|
||||
assert.match(detailPhoneField('联系方式', dashboard.stations[0].contactPhone), /tel:13800000000/);
|
||||
assert.equal(fuzzySearchScore('广州', 'gz'), 3);
|
||||
assert.equal(fuzzySearchScore('广州市', '广州'), 1);
|
||||
assert.ok(stationLocationOptions().some(option => option.level === 'district' && option.district === '黄埔区'));
|
||||
@@ -153,7 +155,9 @@ document.getElementById = id => id === 'navigationLaunchOverlay' ? launchOverlay
|
||||
window.requestAnimationFrame = callback => callback();
|
||||
window.setTimeout = (callback, delay) => { launchTimers.push({ callback, delay }); return launchTimers.length; };
|
||||
window.clearTimeout = () => {};
|
||||
window.location = { assign() {} };
|
||||
const navigationTarget = { opener: {}, location: {} };
|
||||
const openedNavigation = [];
|
||||
window.open = (...args) => { openedNavigation.push(args); return navigationTarget; };
|
||||
selectedEntity = { mode: 'station', entity: dashboard.stations[0] };
|
||||
navigateToSelectedEntity();
|
||||
assert.equal(launchOverlay.hidden, false);
|
||||
@@ -161,6 +165,10 @@ 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]);
|
||||
assert.deepEqual(openedNavigation[0], ['', '_blank']);
|
||||
launchTimers[0].callback();
|
||||
assert.equal(navigationTarget.opener, null);
|
||||
assert.equal(navigationTarget.location.href, stationNavigationUrl);
|
||||
const stationView = stationViewportSummary();
|
||||
assert.equal(stationView.level, 'station');
|
||||
assert.equal(stationView.visibleNodes.length, 2);
|
||||
|
||||
Reference in New Issue
Block a user