feat(workbench): add expense stats detail modal
This commit is contained in:
23
web/tests/expense-stats-detail-modal.test.mjs
Normal file
23
web/tests/expense-stats-detail-modal.test.mjs
Normal file
@@ -0,0 +1,23 @@
|
||||
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/ExpenseStatsDetailModal.vue', import.meta.url)),
|
||||
'utf8'
|
||||
)
|
||||
|
||||
test('expense stats detail modal exposes distribution, processing time and operation detail sections', () => {
|
||||
assert.match(modal, /Expense Operation Details/)
|
||||
assert.match(modal, /历史报销费用分布/)
|
||||
assert.match(modal, /单据处理时间/)
|
||||
assert.match(modal, /系统操作详情/)
|
||||
assert.match(modal, /ElDialog/)
|
||||
assert.match(modal, /ElTag/)
|
||||
assert.match(modal, /distributionRows/)
|
||||
assert.match(modal, /processingRows/)
|
||||
assert.match(modal, /operationRows/)
|
||||
assert.match(modal, /--expense-detail-percent/)
|
||||
assert.match(modal, /统计口径来自当前工作台已加载的个人单据/)
|
||||
})
|
||||
@@ -152,8 +152,24 @@ test('workbench progress rows show update time first', () => {
|
||||
assert.match(workbench, /<time :datetime="item\.updatedAt \|\| ''">\{\{ item\.displayTime \}\}<\/time>/)
|
||||
assert.match(workbench, /displayTime: formatProgressTime\(item\?\.updatedAt\)/)
|
||||
assert.match(workbench, /function formatProgressTime\(value\)/)
|
||||
assert.doesNotMatch(workbench, />全部进度/)
|
||||
assert.match(workbenchStyles, /\.progress-row\s*\{[\s\S]*grid-template-columns:\s*minmax\(78px,\s*0\.44fr\)/)
|
||||
assert.match(workbenchStyles, /\.progress-row\.has-long-duration-divider::before\s*\{[\s\S]*content:\s*"10日以上"/)
|
||||
assert.match(workbenchStyles, /\.progress-row\.has-long-duration-divider::before\s*\{[\s\S]*left:\s*50%;[\s\S]*transform:\s*translateX\(-50%\);/)
|
||||
assert.match(workbenchStyles, /\.progress-row\.has-long-duration-divider::before\s*\{[\s\S]*color:\s*var\(--theme-primary-active\);/)
|
||||
assert.match(workbenchStyles, /\.progress-row\.has-long-duration-divider::after\s*\{[\s\S]*rgba\(var\(--theme-primary-rgb/)
|
||||
assert.match(workbenchStyles, /\.progress-time\s*\{[\s\S]*color:\s*var\(--workbench-muted\);/)
|
||||
assert.match(workbenchResponsiveStyles, /grid-template-areas:[\s\S]*"time identity result"[\s\S]*"steps steps steps"/)
|
||||
})
|
||||
|
||||
test('workbench expense stats detail opens a local modal instead of the assistant', () => {
|
||||
assert.match(workbench, /import ExpenseStatsDetailModal from '\.\/ExpenseStatsDetailModal\.vue'/)
|
||||
assert.match(workbench, /<ExpenseStatsDetailModal/)
|
||||
assert.match(workbench, /const expenseStatsModalOpen = ref\(false\)/)
|
||||
assert.match(workbench, /const expenseStatsDetail = computed\(\(\) => props\.workbenchSummary\.expenseStatsDetail \|\| \{\}\)/)
|
||||
assert.match(workbench, /@click="openExpenseStatsModal"/)
|
||||
assert.match(workbench, /:aria-expanded="expenseStatsModalOpen"/)
|
||||
assert.match(workbench, /function openExpenseStatsModal\(\)/)
|
||||
assert.match(workbench, /function closeExpenseStatsModal\(\)/)
|
||||
assert.doesNotMatch(workbench, /查看我的费用统计详情/)
|
||||
})
|
||||
|
||||
@@ -77,4 +77,12 @@ test('workbench summary builds real user notifications and progress from request
|
||||
)
|
||||
assert.equal(summary.notifications.length, 1)
|
||||
assert.equal(summary.unreadNotificationCount, 1)
|
||||
assert.equal(summary.expenseStatsDetail.distributionRows[0].label, '差旅交通')
|
||||
assert.equal(summary.expenseStatsDetail.distributionRows[0].count, 1)
|
||||
assert.equal(summary.expenseStatsDetail.distributionRows[0].percentLabel, '100%')
|
||||
assert.equal(summary.expenseStatsDetail.processingRows[0].requestId, 'BX-001')
|
||||
assert.equal(summary.expenseStatsDetail.processingRows[0].durationLabel, '10分钟')
|
||||
assert.equal(summary.expenseStatsDetail.processingRows[0].stepCount, 5)
|
||||
assert.ok(summary.expenseStatsDetail.operationRows.some((item) => item.source === '待办'))
|
||||
assert.ok(summary.expenseStatsDetail.operationRows.some((item) => item.source === '进度'))
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user