test(input-number): fix showButton

This commit is contained in:
07akioni 2021-07-28 01:43:16 +08:00
parent 2e3aaa9b34
commit a4d627c80e
2 changed files with 6 additions and 9 deletions

View File

@ -370,6 +370,7 @@ export default defineComponent({
onMousedown={this.handleMouseDown}
>
{{
_: 2, // input number has dynamic slots
prefix: this.$slots.prefix,
suffix: this.showButton
? () => [

View File

@ -8,16 +8,12 @@ describe('n-input-number', () => {
})
it('should work with `show-button` prop', async () => {
const wrapper = mount(NInputNumber, {
props: {
showButton: false
}
})
// Here is a strange case, we must make input number's slots flag to 2
// (dynamic) to make it work.
const wrapper = mount(NInputNumber)
expect(wrapper.findComponent(NButton).exists()).toBe(true)
await wrapper.setProps({ showButton: false })
expect(wrapper.findComponent(NButton).exists()).toBe(false)
// expect(wrapper.findComponent(NButton).exists()).toBe(true)
// await wrapper.setProps({ showButton: false })
})
it('should work with default value', async () => {