优化
This commit is contained in:
@@ -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] } })
|
||||
|
||||
Reference in New Issue
Block a user