test(message): add message provider closable test (#806)

This commit is contained in:
Yugang Cao 2021-08-07 20:37:09 +08:00 committed by GitHub
parent b62bda5127
commit aeb4f553ab
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -87,4 +87,28 @@ describe('message-provider', () => {
}, 1200)
})
})
it('props.closable', (done) => {
const Test = defineComponent({
setup () {
const message = useMessage()
message.info('string')
},
render () {
return null
}
})
const wrapper = mount(NMessageProvider, {
props: {
closable: true
},
slots: {
default: () => <Test />
}
})
void nextTick(() => {
expect(document.querySelector('.n-message__close')).not.toBe(null)
wrapper.unmount()
done()
})
})
})