Skip to content

Commit 8ff7821

Browse files
committed
updated test unit
1 parent 23717e3 commit 8ff7821

File tree

2 files changed

+15
-13
lines changed

2 files changed

+15
-13
lines changed

tests/component/component.minimumFractionDigits.spec.ts

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -6,29 +6,30 @@ describe('VueNumber with minimum fraction digits', () => {
66
const wrapper = mount(VueNumber, {
77
propsData: {
88
value: 123456.893,
9+
precision: 3,
910
minimumFractionDigits: 2
1011
}
1112
})
1213

1314
const input = wrapper.find('input')
14-
expect(input.element.value).toBe('123,456.89')
15+
expect(input.element.value).toBe('123,456.893')
1516

16-
input.element.value = '123456.893'
17+
input.element.value = '123457.893'
1718
await input.trigger('input')
18-
expect(wrapper.vm.unmaskedValue).toBe('123456.89')
19-
expect(wrapper.vm.maskedValue).toBe('123,456.893')
19+
expect(wrapper.vm.unmaskedValue).toBe('123457.893')
20+
expect(wrapper.vm.maskedValue).toBe('123,457.893')
2021

2122
await input.trigger('blur')
22-
expect(wrapper.vm.unmaskedValue).toBe('123456.89')
23-
expect(wrapper.vm.maskedValue).toBe('123,456.89')
23+
expect(wrapper.vm.unmaskedValue).toBe('123457.893')
24+
expect(wrapper.vm.maskedValue).toBe('123,457.893')
2425

25-
input.element.value = '1234.509'
26+
input.element.value = '1234.5'
2627
await input.trigger('input')
27-
expect(wrapper.vm.unmaskedValue).toBe('1234.51')
28-
expect(wrapper.vm.maskedValue).toBe('1,234.509')
28+
expect(wrapper.vm.unmaskedValue).toBe('1234.5')
29+
expect(wrapper.vm.maskedValue).toBe('1,234.5')
2930

3031
await input.trigger('blur')
31-
expect(wrapper.vm.unmaskedValue).toBe('1234.51')
32-
expect(wrapper.vm.maskedValue).toBe('1,234.51')
32+
expect(wrapper.vm.unmaskedValue).toBe('1234.5')
33+
expect(wrapper.vm.maskedValue).toBe('1,234.50')
3334
})
3435
})

tests/directive/directive.minimumFractionDigits.spec.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,17 +12,18 @@ describe('v-number directive', () => {
1212
return {
1313
value: 123456.893,
1414
options: {
15+
precision: 3,
1516
minimumFractionDigits: 2
1617
}
1718
}
1819
}
1920
})
2021

2122
const input = wrapper.find('input')
22-
expect(input.element.value).toBe('123,456.89')
23+
expect(input.element.value).toBe('123,456.893')
2324

2425
await input.trigger('blur')
25-
expect(input.element.value).toBe('123,456.89')
26+
expect(input.element.value).toBe('123,456.893')
2627

2728
input.element.value = '1234.5'
2829
await input.trigger('input')

0 commit comments

Comments
 (0)