| 123456789101112131415161718192021222324252627282930313233343536373839404142434445 |
- import test from 'node:test'
- import assert from 'node:assert/strict'
- import { readFile } from 'node:fs/promises'
- const pageSources = [
- 'src/views/subSystem/waterSupply/facility/gis.vue',
- 'src/views/subSystem/waterSupply/components/WaterDeviceGisMap.vue',
- 'src/views/subSystem/waterSupply/components/WaterAlarmPage.vue'
- ]
- test('water supply GIS pages use the shared page shell', async () => {
- for (const path of pageSources) {
- const source = await readFile(path, 'utf8')
- assert.match(source, /<WaterGisPageShell/u, `${path} should use the shared shell`)
- assert.match(source, /#metrics/u, `${path} should provide metrics`)
- assert.match(source, /#controls/u, `${path} should provide filters`)
- assert.match(source, /#legend/u, `${path} should provide legend`)
- assert.match(source, /#results/u, `${path} should provide search results`)
- assert.match(source, /#map/u, `${path} should provide the map`)
- assert.match(source, /<el-drawer/u, `${path} should keep the right drawer`)
- }
- })
- test('shared shell keeps the side panel and map equal height with one bounded scroll', async () => {
- const source = await readFile('src/components/WaterGisPageShell.vue', 'utf8')
- assert.match(source, /<header class="gis-header"/u)
- assert.match(source, /<div class="gis-layout"/u)
- assert.match(source, /<aside class="side-panel"/u)
- assert.match(source, /<main class="map-panel"/u)
- assert.match(source, /class="side-panel-body"/u)
- assert.match(source, /height: calc\(100vh - 132px\)/u)
- assert.match(source, /overflow: hidden/u)
- assert.match(source, /overflow-y: auto/u)
- assert.doesNotMatch(source, /grid-template-columns:\s*1fr\s+310px/u)
- })
- test('alarm GIS keeps map mode inside the common panel contract', async () => {
- const source = await readFile('src/views/subSystem/waterSupply/components/WaterAlarmPage.vue', 'utf8')
- assert.match(source, /<WaterGisPageShell[\s\S]*?embedded/u)
- assert.match(source, /报警图层与图例/u)
- assert.match(source, /选中报警/u)
- assert.match(source, /@point-click="openDetail"/u)
- })
|