优化
This commit is contained in:
@@ -69,10 +69,43 @@ describe('InboundFeeDetailManager', () => {
|
||||
expect(second).toContain('调整'); expect(second).toContain('作废'); expect(secondButtons).not.toContain('审核')
|
||||
expect(wrapper.find('th').text()).toContain('操作')
|
||||
expect(source).not.toMatch(/<el-button[^>]+link[^>]+(?:编辑|审核|驳回|调整|作废)/)
|
||||
expect(source).toMatch(/size="small" plain type="primary"[^>]+[^>]*>\s*<Pencil/)
|
||||
expect(source).toMatch(/size="small" plain type="success"[^>]+[^>]*>\s*<Check/)
|
||||
expect(source).toMatch(/size="small" plain type="warning"[^>]+[^>]*>\s*<Undo2/)
|
||||
expect(source).toMatch(/size="small" plain type="danger"[^>]+[^>]*>\s*<X/)
|
||||
expect(wrapper.findAll('.el-table__row')[0]!.findAll('.density-actions button').map(button => button.attributes('data-tone'))).toEqual(['neutral', 'warning', 'warning', 'neutral'])
|
||||
expect(wrapper.findAll('.el-table__row')[1]!.findAll('.density-actions button').map(button => button.attributes('data-tone'))).toEqual(['neutral', 'danger'])
|
||||
})
|
||||
|
||||
it.each([
|
||||
[[], [], false],
|
||||
[['delete'], ['删除'], false],
|
||||
[['edit', 'delete'], ['编辑', '删除'], false],
|
||||
[['review', 'delete'], ['审核', '驳回', '删除'], false],
|
||||
[['edit', 'review'], ['编辑', '审核', '驳回'], false],
|
||||
[['edit', 'review', 'delete'], ['编辑', '审核', '驳回', ''], true],
|
||||
])('folds pending fee actions only when more than three are available: %j', async (actions, labels, overflow) => {
|
||||
vi.mocked(listInboundFeeDetails).mockResolvedValue([pending])
|
||||
const wrapper = mountManager(['firstleg:inbound:fee-detail:view', ...actions.map(action => 'firstleg:inbound:fee-detail:' + action)])
|
||||
await flushPromises()
|
||||
const row = wrapper.get('.el-table__row .density-actions')
|
||||
expect(row.findAll('button').map(button => button.text().trim())).toEqual(labels)
|
||||
expect(row.find('.el-dropdown').exists()).toBe(overflow)
|
||||
if (overflow) expect(row.get('.el-dropdown button').attributes('aria-label')).toContain('操作费')
|
||||
})
|
||||
|
||||
it.each(['编辑', '驳回'])('styles the native %s fee dialog at its own root', async action => {
|
||||
const wrapper = mountManager(['firstleg:inbound:fee-detail:view', 'firstleg:inbound:fee-detail:edit', 'firstleg:inbound:fee-detail:review', 'firstleg:fee-item:view'])
|
||||
await flushPromises()
|
||||
await wrapper.get('.el-table__row .density-actions').findAll('button').find(button => button.text().trim() === action)!.trigger('click')
|
||||
await flushPromises()
|
||||
const dialog = document.querySelector<HTMLElement>('.el-dialog.admin-density-dialog')!
|
||||
expect(dialog).not.toBeNull()
|
||||
expect(dialog.querySelector('.density-form')).not.toBeNull()
|
||||
expect(dialog.style.getPropertyValue('--el-dialog-width')).toBe(action === '编辑' ? 'min(680px, calc(100vw - 28px))' : 'min(560px, calc(100vw - 28px))')
|
||||
if (action === '驳回') {
|
||||
const confirm = [...dialog.querySelectorAll<HTMLButtonElement>('button')].find(button => button.textContent?.trim() === '确认驳回')!
|
||||
confirm.click()
|
||||
await flushPromises()
|
||||
expect(reviewInboundFeeDetail).not.toHaveBeenCalled()
|
||||
expect(dialog.querySelector('textarea')?.value).toBe('')
|
||||
} else expect(dialog.textContent).toContain('业务发生日')
|
||||
})
|
||||
|
||||
it('keeps FBA_PRICING rows derived and read-only regardless of write permissions', async () => {
|
||||
|
||||
Reference in New Issue
Block a user