Skip to content
Open
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
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@
"karma-spec-reporter": "^0.0.31",
"karma-webpack": "^2.0.4",
"mocha": "^3.5.0",
"phantomjs-polyfill-object-assign": "0.0.2",
"phantomjs-prebuilt": "^2.1.15",
"sinon": "^3.2.1",
"sinon-chai": "^2.13.0",
Expand Down
25 changes: 19 additions & 6 deletions src/vue-numeric.vue
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
<template>
<input
:placeholder="placeholder"
@blur="onBlurHandler"
@input="onInputHandler"
@focus="onFocusHandler"
v-if="!readOnly"
ref="numeric"
type="tel"
v-model="amount"
v-if="!readOnly"
:placeholder="placeholder"
type="tel"
v-on="inputListeners"
>
<span
v-else
Expand Down Expand Up @@ -195,6 +193,21 @@ export default {
return ','
},

/**
* Define listeners to attach to the input
*/
inputListeners () {
var vm = this;
return Object.assign({},
this.$listeners,
{
blur: vm.onBlurHandler,
input: vm.onInputHandler,
focus: vm.onFocusHandler,
}
);
},

/**
* Define thousand separator based on separator props.
* @return {String} '.' or ','
Expand Down
5 changes: 4 additions & 1 deletion test/karma.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,10 @@ module.exports = config => {
browsers: ['PhantomJS'],
frameworks: ['mocha', 'sinon-chai'],
reporters: ['spec', 'coverage'],
files: ['specs/*.spec.js'],
files: [
'../node_modules/phantomjs-polyfill-object-assign/object-assign-polyfill.js',
'specs/*.spec.js'
],
preprocessors: {
'./specs/*.spec.js': ['webpack', 'sourcemap']
},
Expand Down