Skip to content

Commit 154fc9b

Browse files
committed
v1.6.2
1 parent 2054e8e commit 154fc9b

File tree

4 files changed

+10
-4
lines changed

4 files changed

+10
-4
lines changed

dist/vue-numeric.min.js

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "vue-numeric",
3-
"version": "1.6.1",
3+
"version": "1.6.2",
44
"description": "Input field component to display currency value based on Vue.",
55
"author": "Kevin Ongko",
66
"main": "dist/vue-numeric.min.js",

src/vue-numeric.vue

+1
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,7 @@ export default {
181181
* @return {String} format
182182
*/
183183
formatString () {
184+
if (!this.currency) return '%v'
184185
return this.currencySymbolPosition === 'suffix' ? '%v %s' : '%s %v'
185186
}
186187
},

test/specs/vue-numeric.spec.js

+7-2
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,12 @@ describe('vue-numeric.vue', () => {
1212

1313
it('remove other than numeric value', () => {
1414
const wrapper = mount(VueNumeric, { propsData: { value: '20as00df' } })
15-
expect(wrapper.data().amount).to.equal(' 2,000')
15+
expect(wrapper.data().amount).to.equal('2,000')
1616
})
1717

1818
it('Use default decimal separator', () => {
1919
const wrapper = mount(VueNumeric, { propsData: { value: '2000' } })
20-
expect(wrapper.data().amount).to.equal(' 2,000')
20+
expect(wrapper.data().amount).to.equal('2,000')
2121
})
2222

2323
it('format values with currency prefix', () => {
@@ -150,4 +150,9 @@ describe('vue-numeric.vue', () => {
150150
done()
151151
}, 500);
152152
})
153+
154+
it('remove space if currency props undefined', () => {
155+
const wrapper = mount(VueNumeric, { propsData: { value: 2000 }})
156+
expect(wrapper.data().amount).to.equal('2,000')
157+
})
153158
})

0 commit comments

Comments
 (0)