Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 12 additions & 4 deletions src/vue-numeric.vue
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
<template>
<input
v-if="!readOnly"
ref="numeric"
:placeholder="placeholder"
v-model="amount"
type="tel"
@blur="onBlurHandler"
@input="onInputHandler"
@focus="onFocusHandler"
ref="numeric"
type="tel"
v-model="amount"
v-if="!readOnly"
@change="onChangeHandler"
>
<span
v-else
Expand Down Expand Up @@ -283,6 +284,13 @@ export default {
},

methods: {
/**
* Handle change event.
* @param {Object} e
*/
onChangeHandler (e) {
this.$emit('change', e)
},
/**
* Handle blur event.
* @param {Object} e
Expand Down
6 changes: 6 additions & 0 deletions test/specs/vue-numeric.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -285,4 +285,10 @@ describe('vue-numeric.vue', () => {
})
expect(wrapper.data().amount).to.equal('1 000,94')
})
it('emit change event', () => {
const process = sinon.stub()
const wrapper = mount(VueNumeric, { propsData: { value: 2000 }, methods: { process }})
wrapper.trigger('change')
expect(process.called).to.equal(true)
})
})