Skip to content

Commit

Permalink
test: add case where the input was changed via js
Browse files Browse the repository at this point in the history
  • Loading branch information
zernonia committed May 27, 2024
1 parent 3c90a0c commit c62b09e
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions packages/radix-vue/src/NumberField/NumberField.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,28 @@ describe('numberField', () => {
expect(input.value).toBe('20')
})
})

describe('given setting the input value manually', async () => {
it('should it increase/decrease the value appropriately', async () => {
const { input, increment, decrement } = setup({ defaultValue: 6 })

input.value = '100'
await userEvent.click(increment)
expect(input.value).toBe('101')

input.value = '100'
await userEvent.click(decrement)
expect(input.value).toBe('99')

input.value = ''
await userEvent.click(decrement)
expect(input.value).toBe('0')

input.value = '0'
await userEvent.click(decrement)
expect(input.value).toBe('-1')
})
})
})

describe('given checkbox in a form', async () => {
Expand Down

0 comments on commit c62b09e

Please sign in to comment.