Skip to content

Commit

Permalink
test(dynamic-input): add test (#2568)
Browse files Browse the repository at this point in the history
  • Loading branch information
XieZongChen authored Mar 7, 2022
1 parent ae2eb13 commit 8302dad
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions src/dynamic-input/tests/DynamicInput.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,27 @@ describe('n-dynamic-input', () => {
).toBe('color: green;')
})

it('should work with `min` `max` prop', async () => {
const wrapper = mount(NDynamicInput, {
props: {
value: ['', '', ''],
min: 2,
max: 4
}
})
expect(wrapper.find('.n-button--disabled').exists()).toBe(false)

await wrapper.setProps({ value: ['', ''] })
expect(wrapper.findAll('button')[0].classes()).toContain(
'n-button--disabled'
)

await wrapper.setProps({ value: ['', '', '', ''] })
expect(wrapper.findAll('button')[1].classes()).toContain(
'n-button--disabled'
)
})

it('should work with `placeholder` prop', async () => {
const wrapper = mount(NDynamicInput, {
props: {
Expand Down

0 comments on commit 8302dad

Please sign in to comment.