mirror of
https://github.com/tusen-ai/naive-ui.git
synced 2024-12-21 04:50:14 +08:00
test(popconfirm): update test (#1041)
This commit is contained in:
parent
0c1bb8e825
commit
174377efb9
@ -95,4 +95,27 @@ describe('n-popconfirm', () => {
|
||||
expect(onClick).toHaveBeenCalled()
|
||||
wrapper.unmount()
|
||||
})
|
||||
|
||||
it('should work with slot', async () => {
|
||||
const wrapper = mount(NPopconfirm, {
|
||||
attachTo: document.body,
|
||||
slots: {
|
||||
default: () => 'test-text',
|
||||
trigger: () => h(NButton, null, { default: () => 'test-button' }),
|
||||
action: () => 'test-action',
|
||||
icon: () => 'test-icon'
|
||||
}
|
||||
})
|
||||
|
||||
await wrapper.find('button').trigger('click')
|
||||
expect(document.querySelector('.n-popconfirm__icon')?.textContent).toBe(
|
||||
'test-icon'
|
||||
)
|
||||
expect(
|
||||
document.querySelector('.n-popconfirm__body')?.textContent
|
||||
).toContain('test-text')
|
||||
expect(document.querySelector('.n-popconfirm__action')?.textContent).toBe(
|
||||
'test-action'
|
||||
)
|
||||
})
|
||||
})
|
||||
|
Loading…
Reference in New Issue
Block a user