| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980 |
- import test from 'node:test'
- import assert from 'node:assert/strict'
- import { readFile } from 'node:fs/promises'
- const homePath = 'src/views/subSystem/waterSupply/components/WaterSupplyHome.vue'
- test('home removes the A/B/C placeholder headings', async () => {
- const source = await readFile(homePath, 'utf8')
- assert.doesNotMatch(source, /A · 指挥台/u)
- assert.doesNotMatch(source, /B · 异常待办/u)
- assert.doesNotMatch(source, /C · 数据总览/u)
- })
- test('home realtime alarms split between audit and work order by display status', async () => {
- const source = await readFile(homePath, 'utf8')
- assert.match(source, /openRealtimeAlarm\(item\)/u)
- assert.match(source, /realtimeAlarmJumpTarget\(item\)/u)
- assert.match(source, /goPage\(target\.path, target\.query\)/u)
- assert.match(source, /item\.displayStatusText/u)
- assert.match(source, /item\.displayStatusType/u)
- assert.match(source, /goPage\('\/device\/maintain'/u)
- })
- test('home overview uses the shared GIS map canvas and aggregates all one-map layers', async () => {
- const source = await readFile(homePath, 'utf8')
- assert.match(source, /<GisMapCanvas/u)
- assert.match(source, /ref="overviewMapRef"/u)
- assert.match(source, /:points="overviewMapPoints"/u)
- assert.match(source, /:lines="overviewMapLines"/u)
- assert.match(source, /@point-click="openOverviewPoint"/u)
- assert.match(source, /@line-click="openOverviewPoint"/u)
- assert.match(source, /buildHomeGisOverview/u)
- assert.match(source, /getWaterFacilityFeatures\(\)/u)
- assert.match(source, /listAlarmMapPoints\(\)/u)
- assert.match(source, /getDeviceGisAllPoints\(\)/u)
- })
- test('home overview map takes at least 60% of the same row in desktop layout', async () => {
- const source = await readFile(homePath, 'utf8')
- assert.match(source, /grid-template-columns:\s*minmax\(240px,\s*1fr\)\s+minmax\(0,\s*3fr\)\s+minmax\(240px,\s*1fr\)/u)
- })
- test('home work order jumps point to device maintenance dispatch page', async () => {
- const source = await readFile(homePath, 'utf8')
- const jumps = source.match(/goPage\('\/device\/maintain'/gu) || []
- assert.ok(jumps.length >= 3, 'header, work order rows and related order should all route to device maintain')
- assert.doesNotMatch(source, /monitorAlarm\/workOrder/u)
- assert.match(source, />设备维修派单<\/el-button>/u)
- })
- test('home B-road detail panel is 1:1 with the todo and shortcut panels', async () => {
- const source = await readFile(homePath, 'utf8')
- assert.match(source, /workbench-grid--equal/u)
- assert.match(source, /repeat\(3,\s*minmax\(0,\s*1fr\)\)/u)
- const sectionB = source.match(/<section class="home-section">([\s\S]*?)<el-card shadow="never" class="water-panel home-panel detail-panel">/u)
- assert.ok(sectionB, 'detail panel should live in the equal-width B section')
- })
- test('home list panels scroll to reveal the full queue instead of pinning a few rows', async () => {
- const source = await readFile(homePath, 'utf8')
- const listSelector = source.match(/\.compact-list\s*\{[^}]*\}/u)
- assert.ok(listSelector, 'compact list style block exists')
- assert.match(listSelector[0], /max-height:\s*[\w.]+/u)
- assert.match(listSelector[0], /overflow-y:\s*auto/u)
- assert.match(source, /listRealtimeAlarms\(\),/u)
- })
- test('home overview map fills the full map card body', async () => {
- const source = await readFile(homePath, 'utf8')
- assert.match(source, /\.map-panel[\s\S]{0,160}?display:\s*flex/u)
- assert.match(source, /\.map-stage[\s\S]{0,140}?flex:\s*1/u)
- })
|