Skip to content

Commit

Permalink
#27 - Test for v-model number modifier
Browse files Browse the repository at this point in the history
  • Loading branch information
jonathanpmartins committed Aug 10, 2021
1 parent 2bb8bf0 commit 669695b
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions tests/component.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -267,3 +267,22 @@ test('Test if non masked values are correctly translated', async () => {
expect(updates[updates.length - 1][0]).toBe('5971513.15');
expect(input.element.value).toBe('5,971,513.15');
});

test('Test if the v-model number modifier work correctly', async () => {
const component = mountComponent({
decimal: '.',
thousands: ',',
precision: 3,
masked: false,
modelModifiers: {
number: true,
},
});
const input = component.find('input');

await input.setValue('971513.158');

const updates = component.emitted()['update:model-value'];
expect(updates[updates.length - 1][0]).toBe(971513.158);
expect(input.element.value).toBe('971,513.158');
});

0 comments on commit 669695b

Please sign in to comment.