feat : ajouts du composant input amount

This commit is contained in:
2026-03-03 09:27:28 +01:00
parent ca18f4f3b9
commit 8bf40050e2
2 changed files with 8 additions and 33 deletions

View File

@@ -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 () => {