mirror of
https://github.com/tusen-ai/naive-ui.git
synced 2024-12-21 04:50:14 +08:00
test(descriptions): add NDescriptions slots test
This commit is contained in:
parent
cb929ff479
commit
e53b3bd736
@ -13,6 +13,34 @@ describe('n-descriptions', () => {
|
||||
mount(NDescriptions)
|
||||
})
|
||||
|
||||
it('should work with slots', async () => {
|
||||
let wrapper = mount(NDescriptions, {
|
||||
slots: { default: () => getDescriptionsItemList(), header: () => 'test' }
|
||||
})
|
||||
expect(wrapper.findAll('.n-descriptions-table-header').length).toBe(4)
|
||||
expect(wrapper.findAll('.n-descriptions-table-content').length).toBe(4)
|
||||
|
||||
expect(wrapper.find('.n-descriptions-header').exists()).toBe(true)
|
||||
expect(wrapper.find('.n-descriptions-header').text()).toBe('test')
|
||||
|
||||
wrapper = mount(NDescriptions, {
|
||||
slots: {
|
||||
default: () =>
|
||||
h(NDescriptionsItem, null, {
|
||||
default: () => 'test-default',
|
||||
label: () => 'test-label'
|
||||
})
|
||||
}
|
||||
})
|
||||
|
||||
expect(wrapper.find('.n-descriptions-table-header').text()).toBe(
|
||||
'test-label'
|
||||
)
|
||||
expect(wrapper.find('.n-descriptions-table-content').text()).toBe(
|
||||
'test-default'
|
||||
)
|
||||
})
|
||||
|
||||
it('should work with `bordered` prop', async () => {
|
||||
const wrapper = mount(NDescriptions)
|
||||
expect(wrapper.find('.n-descriptions').classes()).not.toContain(
|
||||
|
Loading…
Reference in New Issue
Block a user