优化
This commit is contained in:
@@ -94,7 +94,7 @@ describe('DataTable column preferences', () => {
|
||||
slots: {
|
||||
'toolbar-start': '<h2>订单列表</h2>',
|
||||
'toolbar-actions': '<button>新增订单</button>',
|
||||
'toolbar-end': '<button>刷新</button>',
|
||||
'toolbar-end': '<button>辅助操作</button>',
|
||||
},
|
||||
global: {
|
||||
provide: { [UI_PREFERENCE_SCOPE as symbol]: computed(() => 'user-1') },
|
||||
@@ -109,10 +109,32 @@ describe('DataTable column preferences', () => {
|
||||
})
|
||||
|
||||
expect(wrapper.findAll('.data-table__toolbar')).toHaveLength(1)
|
||||
expect(wrapper.get('.data-table__toolbar').classes()).not.toContain('is-compact')
|
||||
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__toolbar-actions').text()).toContain('辅助操作')
|
||||
expect(wrapper.get('.data-table__business-actions').text()).toBe('新增订单')
|
||||
expect(wrapper.get('.data-table__toolbar-end').text()).toBe('辅助操作')
|
||||
})
|
||||
|
||||
it('uses a compact right-aligned toolbar when no leading content is provided', () => {
|
||||
const wrapper = shallowMount(DataTable, {
|
||||
props: { data: [], columns: configurableColumns, preferenceKey: 'orders-table' },
|
||||
slots: { 'toolbar-actions': '<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.get('.data-table__toolbar').classes()).toContain('is-compact')
|
||||
expect(wrapper.find('.data-table__toolbar-start').exists()).toBe(false)
|
||||
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