mirror of
https://github.com/tusen-ai/naive-ui.git
synced 2025-02-05 13:00:47 +08:00
test(input-number): fix
This commit is contained in:
parent
d16a7fb995
commit
2e3aaa9b34
@ -373,9 +373,11 @@ export default defineComponent({
|
||||
prefix: this.$slots.prefix,
|
||||
suffix: this.showButton
|
||||
? () => [
|
||||
<span class={`${mergedClsPrefix}-input-number-suffix`}>
|
||||
{{ default: this.$slots.suffix }}
|
||||
</span>,
|
||||
this.$slots.suffix && (
|
||||
<span class={`${mergedClsPrefix}-input-number-suffix`}>
|
||||
{{ default: this.$slots.suffix }}
|
||||
</span>
|
||||
),
|
||||
<NButton
|
||||
text
|
||||
disabled={!this.minusable || this.disabled}
|
||||
|
@ -8,11 +8,16 @@ describe('n-input-number', () => {
|
||||
})
|
||||
|
||||
it('should work with `show-button` prop', async () => {
|
||||
const wrapper = mount(NInputNumber)
|
||||
expect(wrapper.findComponent(NButton).exists()).toBe(true)
|
||||
|
||||
await wrapper.setProps({ showButton: false })
|
||||
const wrapper = mount(NInputNumber, {
|
||||
props: {
|
||||
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 () => {
|
||||
@ -63,9 +68,7 @@ describe('n-input-number', () => {
|
||||
expect(wrapper.find('.n-input__prefix').exists()).toBe(true)
|
||||
expect(wrapper.find('.n-input__prefix').text()).toBe('$')
|
||||
expect(wrapper.find('.n-input__suffix').exists()).toBe(true)
|
||||
expect(wrapper.find('.n-input-number-suffix-has-button').exists()).toBe(
|
||||
true
|
||||
)
|
||||
expect(wrapper.find('.n-input-number-suffix-has-button').text()).toBe('%')
|
||||
expect(wrapper.find('.n-input-number-suffix').exists()).toBe(true)
|
||||
expect(wrapper.find('.n-input-number-suffix').text()).toBe('%')
|
||||
})
|
||||
})
|
||||
|
Loading…
Reference in New Issue
Block a user