This commit is contained in:
2026-08-12 14:08:33 +08:00
parent 4fb8b85c13
commit 975e0057e3
20 changed files with 378 additions and 29 deletions
@@ -87,11 +87,25 @@ describe('TruckAppointmentsView', () => {
it('shows the two frequent row actions directly without a more menu', () => {
expect(source).toContain("v-if=\"access.can('platform:firstleg:truck-appointment:view')\"")
expect(source).toContain("access.can('platform:firstleg:truck-appointment:edit') && ['DRAFT', 'PENDING_DISPATCH', 'RESCHEDULED'].includes(row.status)")
expect(source).toContain('<Eye :size="15" />详情')
expect(source).toContain('<Pencil :size="15" />编辑')
expect(source).not.toContain('MoreHorizontal')
})
it('hides edit for completed appointments rejected by the backend edit contract', async () => {
vi.mocked(listTruckAppointments).mockResolvedValue({
records: [{ ...row, status: 'COMPLETED' }],
page: 1,
size: 20,
total: 1,
pages: 1,
})
const wrapper = mount(TruckAppointmentsView, { global: { plugins: [ElementPlus] } })
await flushPromises()
expect(wrapper.find('button[aria-label="编辑 TA-9001"]').exists()).toBe(false)
})
it('hides the detail action when the account lacks the backend view permission', async () => {
useAuthStore().permissions = ['platform:firstleg:truck-appointment:list']
const wrapper = mount(TruckAppointmentsView, { global: { plugins: [ElementPlus] } })