优化
This commit is contained in:
@@ -0,0 +1,38 @@
|
||||
import { mount } from '@vue/test-utils'
|
||||
import { describe, expect, it } from 'vitest'
|
||||
import DashboardView from './DashboardView.vue'
|
||||
|
||||
describe('DashboardView', () => {
|
||||
it('labels placeholder values and keeps task actions non-operational', () => {
|
||||
const wrapper = mount(DashboardView)
|
||||
|
||||
expect(wrapper.text()).toContain('静态演示数据')
|
||||
expect(wrapper.text()).toContain('演示快照:2026-06-02 08:45')
|
||||
const taskActions = wrapper.findAll('.dashboard-task-action')
|
||||
expect(taskActions).toHaveLength(3)
|
||||
expect(taskActions.every((button) => button.attributes('disabled') !== undefined)).toBe(true)
|
||||
})
|
||||
|
||||
it('switches transport series and exposes the chart values as a data table', async () => {
|
||||
const wrapper = mount(DashboardView)
|
||||
const airButton = wrapper.findAll('button').find((button) => button.text() === '空运')
|
||||
|
||||
expect(airButton).toBeDefined()
|
||||
await airButton!.trigger('click')
|
||||
|
||||
expect(airButton!.attributes('aria-pressed')).toBe('true')
|
||||
expect(wrapper.text()).toContain('空运普货')
|
||||
const caption = wrapper.get('.dashboard-line-chart table caption')
|
||||
expect(caption.text()).toBe('空运近 30 天运单量演示数据')
|
||||
expect(wrapper.findAll('.dashboard-line-chart tbody tr')).toHaveLength(30)
|
||||
})
|
||||
|
||||
it('preserves semantic route names and values in the volume ranking', () => {
|
||||
const wrapper = mount(DashboardView)
|
||||
const ranking = wrapper.get('.dashboard-bars')
|
||||
|
||||
expect(ranking.attributes('role')).toBeUndefined()
|
||||
expect(ranking.text()).toContain('上海 → 洛杉矶')
|
||||
expect(ranking.text()).toContain('850')
|
||||
})
|
||||
})
|
||||
Reference in New Issue
Block a user