feat(navigation): add multi-region picker
This commit is contained in:
@@ -41,12 +41,28 @@ vm.runInNewContext(`
|
||||
globalThis.cityNodeCount = buildStationNodes(filteredStations(), 'city').length;
|
||||
globalThis.stationNodeCount = buildStationNodes(filteredStations(), 'station').length;
|
||||
globalThis.locationOptionCount = stationLocationOptions().length;
|
||||
globalThis.provinceOptionScope = stationLocationOptions().find(option => option.level === 'province' && option.province === '广东省');
|
||||
globalThis.cityOptionScope = stationLocationOptions().find(option => option.level === 'city' && option.city === '广州市');
|
||||
`, sandbox);
|
||||
assert.equal(sandbox.hierarchy.join(','), 'province,city,station');
|
||||
assert.equal(sandbox.provinceNodeCount, 2);
|
||||
assert.equal(sandbox.cityNodeCount, 3);
|
||||
assert.equal(sandbox.stationNodeCount, 3);
|
||||
assert.equal(sandbox.locationOptionCount, 8);
|
||||
assert.equal(sandbox.provinceOptionScope.city, '');
|
||||
assert.equal(sandbox.provinceOptionScope.district, '');
|
||||
assert.equal(sandbox.cityOptionScope.district, '');
|
||||
vm.runInNewContext(`
|
||||
state.regionPicker = { level: 'province', province: '', city: '', search: '', draft: [], options: [] };
|
||||
globalThis.regionProvinceLabels = regionPickerOptions().map(option => option.label).sort().join(',');
|
||||
state.regionPicker = { level: 'city', province: '广东省', city: '', search: '', draft: [], options: [] };
|
||||
globalThis.regionCityLabels = regionPickerOptions().map(option => option.label).sort().join(',');
|
||||
state.regionPicker = { level: 'province', province: '', city: '', search: '嘉兴', draft: [], options: [] };
|
||||
globalThis.regionSearchLabels = regionPickerOptions().map(option => option.label).join(',');
|
||||
`, sandbox);
|
||||
assert.equal(sandbox.regionProvinceLabels, '广东,浙江');
|
||||
assert.equal(sandbox.regionCityLabels, '佛山,广州');
|
||||
assert.match(sandbox.regionSearchLabels, /嘉兴/);
|
||||
vm.runInNewContext(`
|
||||
globalThis.inferredDistrict = stationDistrictName({ province: '浙江省', city: '嘉兴市', address: '嘉兴市海盐县海盐经济开发区' });
|
||||
state.locationFilters = [];
|
||||
@@ -78,6 +94,7 @@ assert.match(source, /stationSearchSuggestions/);
|
||||
assert.match(source, /handleStationSearchInput/);
|
||||
assert.match(source, /locationFilters/);
|
||||
assert.match(source, /renderLocationFilterChips/);
|
||||
assert.match(source, /openRegionPicker/);
|
||||
assert.match(source, /kpiTotal|kpiPartner/);
|
||||
const index = fs.readFileSync(new URL('../index.html', import.meta.url), 'utf8');
|
||||
assert.match(index, /station-summary-strip/);
|
||||
|
||||
Reference in New Issue
Block a user