34 lines
1.4 KiB
JavaScript
34 lines
1.4 KiB
JavaScript
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'/)
|
|
})
|