feat : ajouts du composant input amount
This commit is contained in:
@@ -117,26 +117,26 @@ describe('MalioInputAmount', () => {
|
||||
expect(wrapper.get('input').element.value).toBe('0.5')
|
||||
})
|
||||
|
||||
it('formats the value with two decimals on blur', async () => {
|
||||
it('keeps the normalized decimal value on blur', async () => {
|
||||
const wrapper = mountInputAmount()
|
||||
const input = wrapper.get('input')
|
||||
|
||||
await input.setValue('12.5')
|
||||
await input.trigger('blur')
|
||||
|
||||
expect(wrapper.emitted('update:modelValue')?.[1]).toEqual(['12.50'])
|
||||
expect(input.element.value).toBe('12.50')
|
||||
expect(wrapper.emitted('update:modelValue')).toEqual([['12.5']])
|
||||
expect(input.element.value).toBe('12.5')
|
||||
})
|
||||
|
||||
it('formats integer values with trailing decimals on blur', async () => {
|
||||
it('keeps integer values unchanged on blur', async () => {
|
||||
const wrapper = mountInputAmount()
|
||||
const input = wrapper.get('input')
|
||||
|
||||
await input.setValue('12')
|
||||
await input.trigger('blur')
|
||||
|
||||
expect(wrapper.emitted('update:modelValue')?.[1]).toEqual(['12.00'])
|
||||
expect(input.element.value).toBe('12.00')
|
||||
expect(wrapper.emitted('update:modelValue')).toEqual([['12']])
|
||||
expect(input.element.value).toBe('12')
|
||||
})
|
||||
|
||||
it('keeps an empty value empty on blur', async () => {
|
||||
|
||||
Reference in New Issue
Block a user