Skip to content

Commit 25aee8a

Browse files
committed
2.2.4
1 parent 915b8a1 commit 25aee8a

File tree

6 files changed

+199
-193
lines changed

6 files changed

+199
-193
lines changed

dist/vue-numeric.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/index.html

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,10 @@ <h1 class="title is-4">
9191
<input type="radio" value="." v-model="separator">
9292
use '.' as separator
9393
</label>
94+
<label class="radio">
95+
<input type="radio" value="space" v-model="separator">
96+
use space as separator
97+
</label>
9498
</p>
9599
</div>
96100
<div class="column is-12">
@@ -135,7 +139,7 @@ <h1 class="title is-4">
135139
el: '#app',
136140

137141
data: {
138-
money: 100,
142+
money: 1000,
139143
minValue: 0,
140144
maxValue: 999999,
141145
currency: '$',

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "vue-numeric",
3-
"version": "2.2.3",
3+
"version": "2.2.4",
44
"description": "Input field component to display currency value based on Vue.",
55
"author": "Kevin Ongko",
66
"main": "dist/vue-numeric.min.js",
@@ -46,7 +46,7 @@
4646
"cross-env": "^5.0.5",
4747
"css-loader": "^0.28.7",
4848
"eslint": "^4.6.0",
49-
"eslint-plugin-vue": "3.12.0",
49+
"eslint-plugin-vue": "3.13.1",
5050
"karma": "^1.7.1",
5151
"karma-coverage": "^1.1.1",
5252
"karma-mocha": "^1.3.0",

src/vue-numeric.vue

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -146,8 +146,8 @@ export default {
146146
* @return {String} '.' or ','
147147
*/
148148
decimalSeparator () {
149-
if (this.separator === '.') return ','
150-
return '.'
149+
if (this.separator === ',') return '.'
150+
return ','
151151
},
152152
153153
/**
@@ -156,6 +156,7 @@ export default {
156156
*/
157157
thousandSeparator () {
158158
if (this.separator === '.') return '.'
159+
if (this.separator === 'space') return ' '
159160
return ','
160161
},
161162
@@ -301,9 +302,7 @@ export default {
301302
}
302303
303304
// Set read-only span element's class
304-
if (this.readOnly) {
305-
this.$refs.readOnly.className = this.readOnlyClass
306-
}
305+
if (this.readOnly) this.$refs.readOnly.className = this.readOnlyClass
307306
}
308307
}
309308
</script>

test/specs/vue-numeric.spec.js

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,19 @@ describe('vue-numeric.vue', () => {
4141
expect(wrapper.data().amount).to.equal('$ 2,000.4')
4242
})
4343

44-
it('format values with correct separator', () => {
45-
const wrapper = mount(VueNumeric, { propsData: { value: 2000000, currency: '$', separator: '.' }})
46-
expect(wrapper.data().amount).to.equal('$ 2.000.000')
44+
it('format values with . separator', () => {
45+
const wrapper = mount(VueNumeric, { propsData: { value: 2000000, currency: '$', separator: '.', precision: 2 }})
46+
expect(wrapper.data().amount).to.equal('$ 2.000.000,00')
47+
})
48+
49+
it('format values with , separator', () => {
50+
const wrapper = mount(VueNumeric, { propsData: { value: 2000000, currency: '$', separator: ',', precision: 2 }})
51+
expect(wrapper.data().amount).to.equal('$ 2,000,000.00')
52+
})
53+
54+
it('format values with space separator', () => {
55+
const wrapper = mount(VueNumeric, { propsData: { value: 2000000, currency: '$', separator: 'space', precision: 2 }})
56+
expect(wrapper.data().amount).to.equal('$ 2 000 000,00')
4757
})
4858

4959
it('format values with correct decimals symbol when using different thousand separator', () => {

0 commit comments

Comments
 (0)