fix(workbench): replay profile radar animation

This commit is contained in:
caoxiaozhu
2026-06-03 17:31:12 +08:00
parent 9c24a852e7
commit 67b81a1bd8
3 changed files with 47 additions and 56 deletions

View File

@@ -0,0 +1,33 @@
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/)
})
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'/)
})