优化
This commit is contained in:
@@ -87,4 +87,32 @@ describe('DataTable column preferences', () => {
|
||||
await wrapper.vm.$nextTick()
|
||||
expect(wrapper.findAll('.column-stub').map((column) => column.attributes('data-label'))).toEqual(['操作', '名称', '状态'])
|
||||
})
|
||||
|
||||
it('keeps business actions, column settings, and trailing controls in one toolbar', () => {
|
||||
const wrapper = shallowMount(DataTable, {
|
||||
props: { data: [], columns: configurableColumns, preferenceKey: 'orders-table' },
|
||||
slots: {
|
||||
'toolbar-start': '<h2>订单列表</h2>',
|
||||
'toolbar-actions': '<button>新增订单</button>',
|
||||
'toolbar-end': '<button>刷新</button>',
|
||||
},
|
||||
global: {
|
||||
provide: { [UI_PREFERENCE_SCOPE as symbol]: computed(() => 'user-1') },
|
||||
stubs: {
|
||||
ElTable: TableStub,
|
||||
ElTableColumn: ColumnStub,
|
||||
ElButton: ButtonStub,
|
||||
ElPopover: PopoverStub,
|
||||
},
|
||||
directives: { loading: {} },
|
||||
},
|
||||
})
|
||||
|
||||
expect(wrapper.findAll('.data-table__toolbar')).toHaveLength(1)
|
||||
expect(wrapper.get('.data-table__toolbar-start').text()).toBe('订单列表')
|
||||
expect(wrapper.get('.data-table__toolbar-actions').text()).toContain('新增订单')
|
||||
expect(wrapper.get('.data-table__toolbar-actions').text()).toContain('刷新')
|
||||
expect(wrapper.get('.data-table__business-actions').text()).toBe('新增订单')
|
||||
expect(wrapper.get('.data-table__toolbar-end').text()).toBe('刷新')
|
||||
})
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user