feat(phase3): complete loading workbenches
This commit is contained in:
@@ -36,6 +36,27 @@ describe('TruckAppointmentsView', () => {
|
||||
expect(wrapper.find('button[aria-label="查看 TA-9001"]').exists()).toBe(true)
|
||||
})
|
||||
|
||||
it('uses stable accessible labels when appointment identifiers are missing', async () => {
|
||||
vi.mocked(listTruckAppointments).mockResolvedValue({
|
||||
records: [
|
||||
{ ...row, id: '9002', appointmentNo: '' },
|
||||
{ ...row, id: undefined, appointmentNo: null } as unknown as TruckAppointmentResource,
|
||||
],
|
||||
page: 1,
|
||||
size: 20,
|
||||
total: 2,
|
||||
pages: 1,
|
||||
})
|
||||
const wrapper = mount(TruckAppointmentsView, { global: { plugins: [ElementPlus] } })
|
||||
await flushPromises()
|
||||
|
||||
expect(wrapper.find('button[aria-label="查看 9002"]').exists()).toBe(true)
|
||||
expect(wrapper.find('button[aria-label="查看拖车预约详情"]').exists()).toBe(true)
|
||||
const labels = wrapper.findAll('button[aria-label]').map((button) => button.attributes('aria-label'))
|
||||
expect(labels.every((label) => Boolean(label) && !/undefined|null/.test(label ?? ''))).toBe(true)
|
||||
expect(source).toContain("appointmentActionLabel('编辑', row as TruckAppointmentResource)")
|
||||
})
|
||||
|
||||
it('uses the table toolbar for create and keeps a single empty state', () => {
|
||||
expect(source).toContain('<template #toolbar-actions>')
|
||||
expect(source).not.toContain('<template #toolbar-start>')
|
||||
@@ -43,4 +64,10 @@ describe('TruckAppointmentsView', () => {
|
||||
expect(source).not.toContain('empty-hint')
|
||||
expect(source.match(/empty-text=/g)).toHaveLength(1)
|
||||
})
|
||||
|
||||
it('shows the two frequent row actions directly without a more menu', () => {
|
||||
expect(source).toContain('<Eye :size="15" />详情')
|
||||
expect(source).toContain('<Pencil :size="15" />编辑')
|
||||
expect(source).not.toContain('MoreHorizontal')
|
||||
})
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user