feat(appointment): integrate work calendar and original business actions
This commit is contained in:
@@ -0,0 +1,29 @@
|
||||
import { mount } from '@vue/test-utils'
|
||||
import { expect, it } from 'vitest'
|
||||
import WorkCalendarPanel from './WorkCalendarPanel.vue'
|
||||
import { workCalendar } from './work.test-support'
|
||||
import { workTypes } from './workApi'
|
||||
function render() { return mount(WorkCalendarPanel, { props: { anchor: '2026-10-15', mode: 'month', flow: '', types: [...workTypes], calendar: workCalendar, loading: false, failed: false, reference: false, arrivals: [], referenceReady: false } }) }
|
||||
it('renders server type counts instead of individual event cards and opens exact date/type details', async () => {
|
||||
const wrapper = render()
|
||||
expect(wrapper.findAll('.work-day')).toHaveLength(42)
|
||||
const day = wrapper.get('[data-date="2026-10-15"]')
|
||||
expect(day.get('.day-heading').text()).toContain('2 项')
|
||||
await day.get('[data-type="DELIVERY"]').trigger('click')
|
||||
expect(wrapper.emitted('day')).toEqual([['2026-10-15', 'DELIVERY']]); wrapper.unmount()
|
||||
})
|
||||
it('does not conflate arrivals, no-booking requirements or completed work with confirmed work', async () => {
|
||||
const wrapper = render()
|
||||
await wrapper.setProps({ reference: true, referenceReady: true, arrivals: [{ containerBookingId: '1', cabinetNo: 'D-1', arrivalAt: '2026-10-15T10:00:00', arrivalType: 'ESTIMATED' }] })
|
||||
expect(wrapper.get('[data-date="2026-10-15"] .day-heading').text()).toContain('2 项')
|
||||
expect(wrapper.get('.calendar-counts').text()).toContain('已完成 1')
|
||||
expect(wrapper.get('.calendar-counts').text()).toContain('已落实 0')
|
||||
await wrapper.get('.arrival-reference').trigger('click'); expect(wrapper.emitted('arrivals')).toEqual([['2026-10-15']]); wrapper.unmount()
|
||||
})
|
||||
it('shows explicit all-off and failure states without manufacturing zero aggregates', async () => {
|
||||
const wrapper = render(); await wrapper.setProps({ types: [], calendar: null })
|
||||
expect(wrapper.text()).toContain('全局待办仍可查看'); expect(wrapper.findAll('.type-counts button')).toHaveLength(0)
|
||||
await wrapper.setProps({ types: [...workTypes], failed: true })
|
||||
expect(wrapper.get('.calendar-counts').text()).toBe('工作统计加载失败')
|
||||
expect(wrapper.get('[data-date="2026-10-15"] .day-heading').text()).not.toContain('0 项'); wrapper.unmount()
|
||||
})
|
||||
Reference in New Issue
Block a user