2026-06-03 17:31:12 +08:00
|
|
|
import assert from 'node:assert/strict'
|
|
|
|
|
import { readFileSync } from 'node:fs'
|
|
|
|
|
import test from 'node:test'
|
|
|
|
|
import { fileURLToPath } from 'node:url'
|
|
|
|
|
|
|
|
|
|
const modal = readFileSync(
|
|
|
|
|
fileURLToPath(new URL('../src/components/business/ExpenseProfileDetailModal.vue', import.meta.url)),
|
|
|
|
|
'utf8'
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
const radarChart = readFileSync(
|
|
|
|
|
fileURLToPath(new URL('../src/components/charts/RadarChart.vue', import.meta.url)),
|
|
|
|
|
'utf8'
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
test('expense profile modal remounts the behavior radar when opened', () => {
|
|
|
|
|
assert.match(modal, /destroy-on-close/)
|
|
|
|
|
assert.match(modal, /<RadarChart/)
|
|
|
|
|
assert.match(modal, /:key="radarRenderKey"/)
|
|
|
|
|
assert.match(modal, /const radarRenderKey = ref\(0\)/)
|
|
|
|
|
assert.match(modal, /watch\([\s\S]*\(\) => props\.visible[\s\S]*radarRenderKey\.value \+= 1/)
|
|
|
|
|
assert.match(modal, /scheduleRadarFrame/)
|
|
|
|
|
})
|
|
|
|
|
|
2026-06-09 08:32:00 +00:00
|
|
|
test('expense profile modal uses compact laptop dialog sizing', () => {
|
|
|
|
|
assert.match(modal, /width="min\(960px, calc\(100vw - 64px\)\)"/)
|
|
|
|
|
assert.match(modal, /max-height:\s*min\(580px, calc\(100dvh - 176px\)\)/)
|
|
|
|
|
assert.match(
|
|
|
|
|
modal,
|
|
|
|
|
/@media \(min-width: 861px\) and \(max-width: 1440px\),\s*\n\s*\(min-width: 861px\) and \(max-height: 820px\)/
|
|
|
|
|
)
|
|
|
|
|
assert.match(modal, /width:\s*min\(900px, calc\(100vw - 96px\)\) !important;/)
|
|
|
|
|
assert.match(modal, /max-height:\s*min\(520px, calc\(100dvh - 152px\)\)/)
|
|
|
|
|
assert.match(modal, /\.profile-radar-chart \{[\s\S]*height:\s*248px;/)
|
|
|
|
|
})
|
|
|
|
|
|
2026-06-03 17:31:12 +08:00
|
|
|
test('radar chart uses the shared echarts lifecycle and enables entrance animation', () => {
|
|
|
|
|
assert.match(radarChart, /import \{ useEcharts \} from '\.\.\/\.\.\/composables\/useEcharts\.js'/)
|
|
|
|
|
assert.match(radarChart, /useEcharts\(chartElement, chartOptions\)/)
|
|
|
|
|
assert.match(radarChart, /animation: true/)
|
|
|
|
|
assert.match(radarChart, /animationDuration: 980/)
|
|
|
|
|
assert.match(radarChart, /animationDurationUpdate: 760/)
|
|
|
|
|
assert.match(radarChart, /animationEasing: 'cubicOut'/)
|
|
|
|
|
assert.doesNotMatch(radarChart, /import \{[^}]*init[^}]*\} from 'echarts\/core'/)
|
|
|
|
|
})
|