From 2eb63c19597c7afbeaf780173e0fc951ad431a49 Mon Sep 17 00:00:00 2001 From: Alexandre Bonneau Date: Fri, 23 Mar 2018 13:56:58 -1000 Subject: [PATCH] Fixes #1 Create the unit tests Add Jest for running the unit tests on the component Fix the case of the AutoNumeric import name in the webpack configuration Signed-off-by: Alexandre Bonneau --- CHANGELOG.md | 5 + build/webpack.base.js | 4 +- dist/vue-autonumeric.js | 391 ++- dist/vue-autonumeric.min.js | 2 +- examples-src/App.vue | 2 +- package.json | 14 +- src/components/VueAutonumeric.vue | 6 +- test/unit/.eslintrc | 23 + test/unit/jest.conf.js | 30 + test/unit/setup.js | 3 + test/unit/specs/VueAutonumeric.spec.js | 287 ++ yarn.lock | 4020 +++++++++++++++++------- 12 files changed, 3539 insertions(+), 1248 deletions(-) create mode 100644 test/unit/.eslintrc create mode 100644 test/unit/jest.conf.js create mode 100644 test/unit/setup.js create mode 100644 test/unit/specs/VueAutonumeric.spec.js diff --git a/CHANGELOG.md b/CHANGELOG.md index 5bbe48b..af3192a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,10 @@ ## Changelog for vue-autoNumeric +### 1.1.1 ++ Fixes #1 Create the unit tests + Add Jest for running the unit tests on the component ++ Fix the case of the AutoNumeric import name in the webpack configuration + ### 1.1.0 + Fix issue #10 When using an object to modify both the `:value` and `:options` props, the options is not always modified before the value + Fix the issue where updating the `options` to new ones with a higher `decimalPlacesRawValue` loses the additional decimal places diff --git a/build/webpack.base.js b/build/webpack.base.js index 938dbf1..ae2b3ed 100644 --- a/build/webpack.base.js +++ b/build/webpack.base.js @@ -69,8 +69,8 @@ module.exports = { }, externals: { - // This prevent bundling the AutoNumeric library inside the vue-autornumeric component + // This prevent bundling the AutoNumeric library inside the vue-autonumeric component // cf. https://webpack.js.org/configuration/externals/ - AutoNumeric: 'AutoNumeric', + autonumeric: 'AutoNumeric', }, }; diff --git a/dist/vue-autonumeric.js b/dist/vue-autonumeric.js index 4878996..45130ca 100644 --- a/dist/vue-autonumeric.js +++ b/dist/vue-autonumeric.js @@ -1,5 +1,5 @@ /** - * vue-autonumeric v1.1.0 (https://github.com/autoNumeric/vue-autoNumeric) + * vue-autonumeric v1.1.1 (https://github.com/autoNumeric/vue-autoNumeric) * © 2018 Alexandre Bonneau * Released under the MIT License. */ @@ -12,7 +12,7 @@ exports["VueAutonumeric"] = factory(require("AutoNumeric")); else root["VueAutonumeric"] = factory(root["AutoNumeric"]); -})(this, function(__WEBPACK_EXTERNAL_MODULE_43__) { +})(typeof self !== 'undefined' ? self : this, function(__WEBPACK_EXTERNAL_MODULE_43__) { return /******/ (function(modules) { // webpackBootstrap /******/ // The module cache /******/ var installedModules = {}; @@ -82,8 +82,9 @@ return /******/ (function(modules) { // webpackBootstrap /* 0 */ /***/ (function(module, exports) { -var core = module.exports = {version: '2.4.0'}; -if(typeof __e == 'number')__e = core; // eslint-disable-line no-undef +var core = module.exports = { version: '2.5.3' }; +if (typeof __e == 'number') __e = core; // eslint-disable-line no-undef + /***/ }), /* 1 */ @@ -91,80 +92,91 @@ if(typeof __e == 'number')__e = core; // eslint-disable-line no-undef // https://github.com/zloirock/core-js/issues/86#issuecomment-115759028 var global = module.exports = typeof window != 'undefined' && window.Math == Math - ? window : typeof self != 'undefined' && self.Math == Math ? self : Function('return this')(); -if(typeof __g == 'number')__g = global; // eslint-disable-line no-undef + ? window : typeof self != 'undefined' && self.Math == Math ? self + // eslint-disable-next-line no-new-func + : Function('return this')(); +if (typeof __g == 'number') __g = global; // eslint-disable-line no-undef + /***/ }), /* 2 */ /***/ (function(module, exports) { -module.exports = function(it){ +module.exports = function (it) { return typeof it === 'object' ? it !== null : typeof it === 'function'; }; + /***/ }), /* 3 */ /***/ (function(module, exports, __webpack_require__) { // Thank's IE8 for his funny defineProperty -module.exports = !__webpack_require__(4)(function(){ - return Object.defineProperty({}, 'a', {get: function(){ return 7; }}).a != 7; +module.exports = !__webpack_require__(4)(function () { + return Object.defineProperty({}, 'a', { get: function () { return 7; } }).a != 7; }); + /***/ }), /* 4 */ /***/ (function(module, exports) { -module.exports = function(exec){ +module.exports = function (exec) { try { return !!exec(); - } catch(e){ + } catch (e) { return true; } }; + /***/ }), /* 5 */ /***/ (function(module, exports, __webpack_require__) { // to indexed object, toObject with fallback for non-array-like ES3 strings -var IObject = __webpack_require__(6) - , defined = __webpack_require__(7); -module.exports = function(it){ +var IObject = __webpack_require__(6); +var defined = __webpack_require__(7); +module.exports = function (it) { return IObject(defined(it)); }; + /***/ }), /* 6 */ /***/ (function(module, exports, __webpack_require__) { // fallback for non-array-like ES3 and non-enumerable old V8 strings var cof = __webpack_require__(32); -module.exports = Object('z').propertyIsEnumerable(0) ? Object : function(it){ +// eslint-disable-next-line no-prototype-builtins +module.exports = Object('z').propertyIsEnumerable(0) ? Object : function (it) { return cof(it) == 'String' ? it.split('') : Object(it); }; + /***/ }), /* 7 */ /***/ (function(module, exports) { // 7.2.1 RequireObjectCoercible(argument) -module.exports = function(it){ - if(it == undefined)throw TypeError("Can't call method on " + it); +module.exports = function (it) { + if (it == undefined) throw TypeError("Can't call method on " + it); return it; }; + /***/ }), /* 8 */ /***/ (function(module, exports) { // 7.1.4 ToInteger -var ceil = Math.ceil - , floor = Math.floor; -module.exports = function(it){ +var ceil = Math.ceil; +var floor = Math.floor; +module.exports = function (it) { return isNaN(it = +it) ? 0 : (it > 0 ? floor : ceil)(it); }; + /***/ }), /* 9 */ /***/ (function(module, exports, __webpack_require__) { @@ -284,9 +296,9 @@ var _assign = __webpack_require__(15); var _assign2 = _interopRequireDefault(_assign); -var _AutoNumeric = __webpack_require__(43); +var _autonumeric = __webpack_require__(43); -var _AutoNumeric2 = _interopRequireDefault(_AutoNumeric); +var _autonumeric2 = _interopRequireDefault(_autonumeric); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } @@ -383,7 +395,7 @@ exports.default = { options = this.manageOptionElement(this.options); } - this.anElement = new _AutoNumeric2.default(this.$refs.autoNumericElement, options); + this.anElement = new _autonumeric2.default(this.$refs.autoNumericElement, options); if (this.value !== null && this.value !== '') { this.anElement.set(this.value); @@ -417,7 +429,7 @@ exports.default = { manageOptionElement: function manageOptionElement(optionElement) { var options = void 0; if (typeof optionElement === 'string' || optionElement instanceof String) { - options = _AutoNumeric2.default.getPredefinedOptions()[optionElement]; + options = _autonumeric2.default.getPredefinedOptions()[optionElement]; if (options === void 0 || options === null) { console.warn('The given pre-defined options [' + optionElement + '] is not recognized by autoNumeric.\nSwitching back to the default options.'); options = defaultOptions; @@ -436,15 +448,15 @@ exports.default = { var optionsToUse = void 0; if (this.resetOnOptions) { if (Array.isArray(newValue.options)) { - newValue.options = _AutoNumeric2.default.mergeOptions(newValue.options); + newValue.options = _autonumeric2.default.mergeOptions(newValue.options); } var decimalPlacesRawValue = this.anElement.getSettings().decimalPlacesRawValue; - var newOptions = _AutoNumeric2.default._getOptionObject(newValue.options); + var newOptions = _autonumeric2.default._getOptionObject(newValue.options); if (newOptions.decimalPlaces && newOptions.decimalPlaces > decimalPlacesRawValue) { - optionsToUse = (0, _assign2.default)({}, _AutoNumeric2.default.getDefaultConfig(), newOptions); + optionsToUse = (0, _assign2.default)({}, _autonumeric2.default.getDefaultConfig(), newOptions); } else { - optionsToUse = (0, _assign2.default)({}, _AutoNumeric2.default.getDefaultConfig(), { decimalPlacesRawValue: decimalPlacesRawValue }, newOptions); + optionsToUse = (0, _assign2.default)({}, _autonumeric2.default.getDefaultConfig(), { decimalPlacesRawValue: decimalPlacesRawValue }, newOptions); } } else { optionsToUse = newValue.options; @@ -480,12 +492,13 @@ module.exports = { "default": __webpack_require__(14), __esModule: true }; /* 14 */ /***/ (function(module, exports, __webpack_require__) { -var core = __webpack_require__(0) - , $JSON = core.JSON || (core.JSON = {stringify: JSON.stringify}); -module.exports = function stringify(it){ // eslint-disable-line no-unused-vars +var core = __webpack_require__(0); +var $JSON = core.JSON || (core.JSON = { stringify: JSON.stringify }); +module.exports = function stringify(it) { // eslint-disable-line no-unused-vars return $JSON.stringify.apply($JSON, arguments); }; + /***/ }), /* 15 */ /***/ (function(module, exports, __webpack_require__) { @@ -499,6 +512,7 @@ module.exports = { "default": __webpack_require__(16), __esModule: true }; __webpack_require__(17); module.exports = __webpack_require__(0).Object.assign; + /***/ }), /* 17 */ /***/ (function(module, exports, __webpack_require__) { @@ -506,34 +520,35 @@ module.exports = __webpack_require__(0).Object.assign; // 19.1.3.1 Object.assign(target, source) var $export = __webpack_require__(18); -$export($export.S + $export.F, 'Object', {assign: __webpack_require__(28)}); +$export($export.S + $export.F, 'Object', { assign: __webpack_require__(28) }); + /***/ }), /* 18 */ /***/ (function(module, exports, __webpack_require__) { -var global = __webpack_require__(1) - , core = __webpack_require__(0) - , ctx = __webpack_require__(19) - , hide = __webpack_require__(21) - , PROTOTYPE = 'prototype'; - -var $export = function(type, name, source){ - var IS_FORCED = type & $export.F - , IS_GLOBAL = type & $export.G - , IS_STATIC = type & $export.S - , IS_PROTO = type & $export.P - , IS_BIND = type & $export.B - , IS_WRAP = type & $export.W - , exports = IS_GLOBAL ? core : core[name] || (core[name] = {}) - , expProto = exports[PROTOTYPE] - , target = IS_GLOBAL ? global : IS_STATIC ? global[name] : (global[name] || {})[PROTOTYPE] - , key, own, out; - if(IS_GLOBAL)source = name; - for(key in source){ +var global = __webpack_require__(1); +var core = __webpack_require__(0); +var ctx = __webpack_require__(19); +var hide = __webpack_require__(21); +var PROTOTYPE = 'prototype'; + +var $export = function (type, name, source) { + var IS_FORCED = type & $export.F; + var IS_GLOBAL = type & $export.G; + var IS_STATIC = type & $export.S; + var IS_PROTO = type & $export.P; + var IS_BIND = type & $export.B; + var IS_WRAP = type & $export.W; + var exports = IS_GLOBAL ? core : core[name] || (core[name] = {}); + var expProto = exports[PROTOTYPE]; + var target = IS_GLOBAL ? global : IS_STATIC ? global[name] : (global[name] || {})[PROTOTYPE]; + var key, own, out; + if (IS_GLOBAL) source = name; + for (key in source) { // contains in native own = !IS_FORCED && target && target[key] !== undefined; - if(own && key in exports)continue; + if (own && key in exports) continue; // export native or passed out = own ? target[key] : source[key]; // prevent global pollution for namespaces @@ -541,11 +556,11 @@ var $export = function(type, name, source){ // bind timers to global for call from export context : IS_BIND && own ? ctx(out, global) // wrap global constructors for prevent change them in library - : IS_WRAP && target[key] == out ? (function(C){ - var F = function(a, b, c){ - if(this instanceof C){ - switch(arguments.length){ - case 0: return new C; + : IS_WRAP && target[key] == out ? (function (C) { + var F = function (a, b, c) { + if (this instanceof C) { + switch (arguments.length) { + case 0: return new C(); case 1: return new C(a); case 2: return new C(a, b); } return new C(a, b, c); @@ -556,10 +571,10 @@ var $export = function(type, name, source){ // make static versions for prototype methods })(out) : IS_PROTO && typeof out == 'function' ? ctx(Function.call, out) : out; // export proto methods to core.%CONSTRUCTOR%.methods.%NAME% - if(IS_PROTO){ + if (IS_PROTO) { (exports.virtual || (exports.virtual = {}))[key] = out; // export proto methods to core.%CONSTRUCTOR%.prototype.%NAME% - if(type & $export.R && expProto && !expProto[key])hide(expProto, key, out); + if (type & $export.R && expProto && !expProto[key]) hide(expProto, key, out); } } }; @@ -571,107 +586,115 @@ $export.P = 8; // proto $export.B = 16; // bind $export.W = 32; // wrap $export.U = 64; // safe -$export.R = 128; // real proto method for `library` +$export.R = 128; // real proto method for `library` module.exports = $export; + /***/ }), /* 19 */ /***/ (function(module, exports, __webpack_require__) { // optional / simple context binding var aFunction = __webpack_require__(20); -module.exports = function(fn, that, length){ +module.exports = function (fn, that, length) { aFunction(fn); - if(that === undefined)return fn; - switch(length){ - case 1: return function(a){ + if (that === undefined) return fn; + switch (length) { + case 1: return function (a) { return fn.call(that, a); }; - case 2: return function(a, b){ + case 2: return function (a, b) { return fn.call(that, a, b); }; - case 3: return function(a, b, c){ + case 3: return function (a, b, c) { return fn.call(that, a, b, c); }; } - return function(/* ...args */){ + return function (/* ...args */) { return fn.apply(that, arguments); }; }; + /***/ }), /* 20 */ /***/ (function(module, exports) { -module.exports = function(it){ - if(typeof it != 'function')throw TypeError(it + ' is not a function!'); +module.exports = function (it) { + if (typeof it != 'function') throw TypeError(it + ' is not a function!'); return it; }; + /***/ }), /* 21 */ /***/ (function(module, exports, __webpack_require__) { -var dP = __webpack_require__(22) - , createDesc = __webpack_require__(27); -module.exports = __webpack_require__(3) ? function(object, key, value){ +var dP = __webpack_require__(22); +var createDesc = __webpack_require__(27); +module.exports = __webpack_require__(3) ? function (object, key, value) { return dP.f(object, key, createDesc(1, value)); -} : function(object, key, value){ +} : function (object, key, value) { object[key] = value; return object; }; + /***/ }), /* 22 */ /***/ (function(module, exports, __webpack_require__) { -var anObject = __webpack_require__(23) - , IE8_DOM_DEFINE = __webpack_require__(24) - , toPrimitive = __webpack_require__(26) - , dP = Object.defineProperty; +var anObject = __webpack_require__(23); +var IE8_DOM_DEFINE = __webpack_require__(24); +var toPrimitive = __webpack_require__(26); +var dP = Object.defineProperty; -exports.f = __webpack_require__(3) ? Object.defineProperty : function defineProperty(O, P, Attributes){ +exports.f = __webpack_require__(3) ? Object.defineProperty : function defineProperty(O, P, Attributes) { anObject(O); P = toPrimitive(P, true); anObject(Attributes); - if(IE8_DOM_DEFINE)try { + if (IE8_DOM_DEFINE) try { return dP(O, P, Attributes); - } catch(e){ /* empty */ } - if('get' in Attributes || 'set' in Attributes)throw TypeError('Accessors not supported!'); - if('value' in Attributes)O[P] = Attributes.value; + } catch (e) { /* empty */ } + if ('get' in Attributes || 'set' in Attributes) throw TypeError('Accessors not supported!'); + if ('value' in Attributes) O[P] = Attributes.value; return O; }; + /***/ }), /* 23 */ /***/ (function(module, exports, __webpack_require__) { var isObject = __webpack_require__(2); -module.exports = function(it){ - if(!isObject(it))throw TypeError(it + ' is not an object!'); +module.exports = function (it) { + if (!isObject(it)) throw TypeError(it + ' is not an object!'); return it; }; + /***/ }), /* 24 */ /***/ (function(module, exports, __webpack_require__) { -module.exports = !__webpack_require__(3) && !__webpack_require__(4)(function(){ - return Object.defineProperty(__webpack_require__(25)('div'), 'a', {get: function(){ return 7; }}).a != 7; +module.exports = !__webpack_require__(3) && !__webpack_require__(4)(function () { + return Object.defineProperty(__webpack_require__(25)('div'), 'a', { get: function () { return 7; } }).a != 7; }); + /***/ }), /* 25 */ /***/ (function(module, exports, __webpack_require__) { -var isObject = __webpack_require__(2) - , document = __webpack_require__(1).document - // in old IE typeof document.createElement is 'object' - , is = isObject(document) && isObject(document.createElement); -module.exports = function(it){ +var isObject = __webpack_require__(2); +var document = __webpack_require__(1).document; +// typeof document.createElement is 'object' in old IE +var is = isObject(document) && isObject(document.createElement); +module.exports = function (it) { return is ? document.createElement(it) : {}; }; + /***/ }), /* 26 */ /***/ (function(module, exports, __webpack_require__) { @@ -680,28 +703,30 @@ module.exports = function(it){ var isObject = __webpack_require__(2); // instead of the ES6 spec version, we didn't implement @@toPrimitive case // and the second argument - flag - preferred type is a string -module.exports = function(it, S){ - if(!isObject(it))return it; +module.exports = function (it, S) { + if (!isObject(it)) return it; var fn, val; - if(S && typeof (fn = it.toString) == 'function' && !isObject(val = fn.call(it)))return val; - if(typeof (fn = it.valueOf) == 'function' && !isObject(val = fn.call(it)))return val; - if(!S && typeof (fn = it.toString) == 'function' && !isObject(val = fn.call(it)))return val; + if (S && typeof (fn = it.toString) == 'function' && !isObject(val = fn.call(it))) return val; + if (typeof (fn = it.valueOf) == 'function' && !isObject(val = fn.call(it))) return val; + if (!S && typeof (fn = it.toString) == 'function' && !isObject(val = fn.call(it))) return val; throw TypeError("Can't convert object to primitive value"); }; + /***/ }), /* 27 */ /***/ (function(module, exports) { -module.exports = function(bitmap, value){ +module.exports = function (bitmap, value) { return { - enumerable : !(bitmap & 1), + enumerable: !(bitmap & 1), configurable: !(bitmap & 2), - writable : !(bitmap & 4), - value : value + writable: !(bitmap & 4), + value: value }; }; + /***/ }), /* 28 */ /***/ (function(module, exports, __webpack_require__) { @@ -709,171 +734,185 @@ module.exports = function(bitmap, value){ "use strict"; // 19.1.2.1 Object.assign(target, source, ...) -var getKeys = __webpack_require__(29) - , gOPS = __webpack_require__(40) - , pIE = __webpack_require__(41) - , toObject = __webpack_require__(42) - , IObject = __webpack_require__(6) - , $assign = Object.assign; +var getKeys = __webpack_require__(29); +var gOPS = __webpack_require__(40); +var pIE = __webpack_require__(41); +var toObject = __webpack_require__(42); +var IObject = __webpack_require__(6); +var $assign = Object.assign; // should work with symbols and should have deterministic property order (V8 bug) -module.exports = !$assign || __webpack_require__(4)(function(){ - var A = {} - , B = {} - , S = Symbol() - , K = 'abcdefghijklmnopqrst'; +module.exports = !$assign || __webpack_require__(4)(function () { + var A = {}; + var B = {}; + // eslint-disable-next-line no-undef + var S = Symbol(); + var K = 'abcdefghijklmnopqrst'; A[S] = 7; - K.split('').forEach(function(k){ B[k] = k; }); + K.split('').forEach(function (k) { B[k] = k; }); return $assign({}, A)[S] != 7 || Object.keys($assign({}, B)).join('') != K; -}) ? function assign(target, source){ // eslint-disable-line no-unused-vars - var T = toObject(target) - , aLen = arguments.length - , index = 1 - , getSymbols = gOPS.f - , isEnum = pIE.f; - while(aLen > index){ - var S = IObject(arguments[index++]) - , keys = getSymbols ? getKeys(S).concat(getSymbols(S)) : getKeys(S) - , length = keys.length - , j = 0 - , key; - while(length > j)if(isEnum.call(S, key = keys[j++]))T[key] = S[key]; +}) ? function assign(target, source) { // eslint-disable-line no-unused-vars + var T = toObject(target); + var aLen = arguments.length; + var index = 1; + var getSymbols = gOPS.f; + var isEnum = pIE.f; + while (aLen > index) { + var S = IObject(arguments[index++]); + var keys = getSymbols ? getKeys(S).concat(getSymbols(S)) : getKeys(S); + var length = keys.length; + var j = 0; + var key; + while (length > j) if (isEnum.call(S, key = keys[j++])) T[key] = S[key]; } return T; } : $assign; + /***/ }), /* 29 */ /***/ (function(module, exports, __webpack_require__) { // 19.1.2.14 / 15.2.3.14 Object.keys(O) -var $keys = __webpack_require__(30) - , enumBugKeys = __webpack_require__(39); +var $keys = __webpack_require__(30); +var enumBugKeys = __webpack_require__(39); -module.exports = Object.keys || function keys(O){ +module.exports = Object.keys || function keys(O) { return $keys(O, enumBugKeys); }; + /***/ }), /* 30 */ /***/ (function(module, exports, __webpack_require__) { -var has = __webpack_require__(31) - , toIObject = __webpack_require__(5) - , arrayIndexOf = __webpack_require__(33)(false) - , IE_PROTO = __webpack_require__(36)('IE_PROTO'); - -module.exports = function(object, names){ - var O = toIObject(object) - , i = 0 - , result = [] - , key; - for(key in O)if(key != IE_PROTO)has(O, key) && result.push(key); +var has = __webpack_require__(31); +var toIObject = __webpack_require__(5); +var arrayIndexOf = __webpack_require__(33)(false); +var IE_PROTO = __webpack_require__(36)('IE_PROTO'); + +module.exports = function (object, names) { + var O = toIObject(object); + var i = 0; + var result = []; + var key; + for (key in O) if (key != IE_PROTO) has(O, key) && result.push(key); // Don't enum bug & hidden keys - while(names.length > i)if(has(O, key = names[i++])){ + while (names.length > i) if (has(O, key = names[i++])) { ~arrayIndexOf(result, key) || result.push(key); } return result; }; + /***/ }), /* 31 */ /***/ (function(module, exports) { var hasOwnProperty = {}.hasOwnProperty; -module.exports = function(it, key){ +module.exports = function (it, key) { return hasOwnProperty.call(it, key); }; + /***/ }), /* 32 */ /***/ (function(module, exports) { var toString = {}.toString; -module.exports = function(it){ +module.exports = function (it) { return toString.call(it).slice(8, -1); }; + /***/ }), /* 33 */ /***/ (function(module, exports, __webpack_require__) { // false -> Array#indexOf // true -> Array#includes -var toIObject = __webpack_require__(5) - , toLength = __webpack_require__(34) - , toIndex = __webpack_require__(35); -module.exports = function(IS_INCLUDES){ - return function($this, el, fromIndex){ - var O = toIObject($this) - , length = toLength(O.length) - , index = toIndex(fromIndex, length) - , value; +var toIObject = __webpack_require__(5); +var toLength = __webpack_require__(34); +var toAbsoluteIndex = __webpack_require__(35); +module.exports = function (IS_INCLUDES) { + return function ($this, el, fromIndex) { + var O = toIObject($this); + var length = toLength(O.length); + var index = toAbsoluteIndex(fromIndex, length); + var value; // Array#includes uses SameValueZero equality algorithm - if(IS_INCLUDES && el != el)while(length > index){ + // eslint-disable-next-line no-self-compare + if (IS_INCLUDES && el != el) while (length > index) { value = O[index++]; - if(value != value)return true; - // Array#toIndex ignores holes, Array#includes - not - } else for(;length > index; index++)if(IS_INCLUDES || index in O){ - if(O[index] === el)return IS_INCLUDES || index || 0; + // eslint-disable-next-line no-self-compare + if (value != value) return true; + // Array#indexOf ignores holes, Array#includes - not + } else for (;length > index; index++) if (IS_INCLUDES || index in O) { + if (O[index] === el) return IS_INCLUDES || index || 0; } return !IS_INCLUDES && -1; }; }; + /***/ }), /* 34 */ /***/ (function(module, exports, __webpack_require__) { // 7.1.15 ToLength -var toInteger = __webpack_require__(8) - , min = Math.min; -module.exports = function(it){ +var toInteger = __webpack_require__(8); +var min = Math.min; +module.exports = function (it) { return it > 0 ? min(toInteger(it), 0x1fffffffffffff) : 0; // pow(2, 53) - 1 == 9007199254740991 }; + /***/ }), /* 35 */ /***/ (function(module, exports, __webpack_require__) { -var toInteger = __webpack_require__(8) - , max = Math.max - , min = Math.min; -module.exports = function(index, length){ +var toInteger = __webpack_require__(8); +var max = Math.max; +var min = Math.min; +module.exports = function (index, length) { index = toInteger(index); return index < 0 ? max(index + length, 0) : min(index, length); }; + /***/ }), /* 36 */ /***/ (function(module, exports, __webpack_require__) { -var shared = __webpack_require__(37)('keys') - , uid = __webpack_require__(38); -module.exports = function(key){ +var shared = __webpack_require__(37)('keys'); +var uid = __webpack_require__(38); +module.exports = function (key) { return shared[key] || (shared[key] = uid(key)); }; + /***/ }), /* 37 */ /***/ (function(module, exports, __webpack_require__) { -var global = __webpack_require__(1) - , SHARED = '__core-js_shared__' - , store = global[SHARED] || (global[SHARED] = {}); -module.exports = function(key){ +var global = __webpack_require__(1); +var SHARED = '__core-js_shared__'; +var store = global[SHARED] || (global[SHARED] = {}); +module.exports = function (key) { return store[key] || (store[key] = {}); }; + /***/ }), /* 38 */ /***/ (function(module, exports) { -var id = 0 - , px = Math.random(); -module.exports = function(key){ +var id = 0; +var px = Math.random(); +module.exports = function (key) { return 'Symbol('.concat(key === undefined ? '' : key, ')_', (++id + px).toString(36)); }; + /***/ }), /* 39 */ /***/ (function(module, exports) { @@ -883,28 +922,32 @@ module.exports = ( 'constructor,hasOwnProperty,isPrototypeOf,propertyIsEnumerable,toLocaleString,toString,valueOf' ).split(','); + /***/ }), /* 40 */ /***/ (function(module, exports) { exports.f = Object.getOwnPropertySymbols; + /***/ }), /* 41 */ /***/ (function(module, exports) { exports.f = {}.propertyIsEnumerable; + /***/ }), /* 42 */ /***/ (function(module, exports, __webpack_require__) { // 7.1.13 ToObject(argument) var defined = __webpack_require__(7); -module.exports = function(it){ +module.exports = function (it) { return Object(defined(it)); }; + /***/ }), /* 43 */ /***/ (function(module, exports) { diff --git a/dist/vue-autonumeric.min.js b/dist/vue-autonumeric.min.js index 615cdff..8161c3e 100644 --- a/dist/vue-autonumeric.min.js +++ b/dist/vue-autonumeric.min.js @@ -1 +1 @@ -!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e(require("AutoNumeric")):"function"==typeof define&&define.amd?define("VueAutonumeric",["AutoNumeric"],e):"object"==typeof exports?exports.VueAutonumeric=e(require("AutoNumeric")):t.VueAutonumeric=e(t.AutoNumeric)}(this,function(t){return function(t){function e(r){if(n[r])return n[r].exports;var o=n[r]={i:r,l:!1,exports:{}};return t[r].call(o.exports,o,o.exports,e),o.l=!0,o.exports}var n={};return e.m=t,e.c=n,e.d=function(t,n,r){e.o(t,n)||Object.defineProperty(t,n,{configurable:!1,enumerable:!0,get:r})},e.n=function(t){var n=t&&t.__esModule?function(){return t.default}:function(){return t};return e.d(n,"a",n),n},e.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},e.p="",e(e.s=9)}([function(t,e){var n=t.exports={version:"2.4.0"};"number"==typeof __e&&(__e=n)},function(t,e){var n=t.exports="undefined"!=typeof window&&window.Math==Math?window:"undefined"!=typeof self&&self.Math==Math?self:Function("return this")();"number"==typeof __g&&(__g=n)},function(t,e){t.exports=function(t){return"object"==typeof t?null!==t:"function"==typeof t}},function(t,e,n){t.exports=!n(4)(function(){return 7!=Object.defineProperty({},"a",{get:function(){return 7}}).a})},function(t,e){t.exports=function(t){try{return!!t()}catch(t){return!0}}},function(t,e,n){var r=n(6),o=n(7);t.exports=function(t){return r(o(t))}},function(t,e,n){var r=n(32);t.exports=Object("z").propertyIsEnumerable(0)?Object:function(t){return"String"==r(t)?t.split(""):Object(t)}},function(t,e){t.exports=function(t){if(void 0==t)throw TypeError("Can't call method on "+t);return t}},function(t,e){var n=Math.ceil,r=Math.floor;t.exports=function(t){return isNaN(t=+t)?0:(t>0?r:n)(t)}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.VueAutonumeric=void 0;var r=n(10),o=function(t){return t&&t.__esModule?t:{default:t}}(r);"undefined"!=typeof window&&window.Vue&&Vue.component("vue-autonumeric",o.default),e.VueAutonumeric=o.default,e.default=o.default},function(t,e,n){var r=n(11)(n(12),null,null,null);t.exports=r.exports},function(t,e){t.exports=function(t,e,n,r){var o,i=t=t||{},u=typeof t.default;"object"!==u&&"function"!==u||(o=t,i=t.default);var c="function"==typeof i?i.options:i;if(e&&(c.render=e.render,c.staticRenderFns=e.staticRenderFns),n&&(c._scopeId=n),r){var a=Object.create(c.computed||null);Object.keys(r).forEach(function(t){var e=r[t];a[t]=function(){return e}}),c.computed=a}return{esModule:o,exports:i,options:c}}},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{default:t}}Object.defineProperty(e,"__esModule",{value:!0});var o=n(13),i=r(o),u=n(15),c=r(u),a=n(43),f=r(a),s={};e.default={name:"VueAutonumeric",render:function(t){var e="input"===this.tag,n=void 0;return n=e?{type:"text",placeholder:this.placeholder}:{contenteditable:!0},t(this.tag,{attrs:n,ref:"autoNumericElement",on:{keydown:this.setUserInteraction,paste:this.setUserInteraction,wheel:this.setUserInteraction,drop:this.setUserInteraction,keyup:this.resetUserInteraction,blur:this.resetUserInteraction,"autoNumeric:rawValueModified":this.updateVModel}})},props:{value:{type:Number,required:!1},options:{type:[Object,String,Array],required:!1,default:function(){return s}},resetOnOptions:{type:Boolean,required:!1,default:!0},placeholder:{type:String,required:!1},tag:{type:String,required:!1,default:"input"}},data:function(){return{anElement:null,userInteraction:!1}},mounted:function(){var t=this,e=void 0;if(Array.isArray(this.options)){var n={};this.options.forEach(function(r){e=t.manageOptionElement(r),n=(0,c.default)(n,e)}),e=n}else e=this.manageOptionElement(this.options);this.anElement=new f.default(this.$refs.autoNumericElement,e),null!==this.value&&""!==this.value&&(this.anElement.set(this.value),this.updateVModel(),this.resetUserInteraction())},computed:{anInfo:function(){return{value:this.value,options:this.options}}},methods:{updateVModel:function(t){null!==this.anElement&&this.$emit("input",this.anElement.getNumber(),t)},setUserInteraction:function(){this.userInteraction=!0},resetUserInteraction:function(){this.userInteraction=!1},manageOptionElement:function(t){var e=void 0;return"string"==typeof t||t instanceof String?void 0!==(e=f.default.getPredefinedOptions()[t])&&null!==e||(console.warn("The given pre-defined options ["+t+"] is not recognized by autoNumeric.\nSwitching back to the default options."),e=s):e=t,e}},watch:{anInfo:function(t,e){if(e.options&&(0,i.default)(t.options)!==(0,i.default)(e.options)){var n=void 0;if(this.resetOnOptions){Array.isArray(t.options)&&(t.options=f.default.mergeOptions(t.options));var r=this.anElement.getSettings().decimalPlacesRawValue,o=f.default._getOptionObject(t.options);n=o.decimalPlaces&&o.decimalPlaces>r?(0,c.default)({},f.default.getDefaultConfig(),o):(0,c.default)({},f.default.getDefaultConfig(),{decimalPlacesRawValue:r},o)}else n=t.options;this.anElement.update(n)}if(void 0!==t.value){try{this.userInteraction||t.value!==e.value&&this.anElement.set(t.value)}catch(t){console.error(t)}this.resetUserInteraction()}}}}},function(t,e,n){t.exports={default:n(14),__esModule:!0}},function(t,e,n){var r=n(0),o=r.JSON||(r.JSON={stringify:JSON.stringify});t.exports=function(t){return o.stringify.apply(o,arguments)}},function(t,e,n){t.exports={default:n(16),__esModule:!0}},function(t,e,n){n(17),t.exports=n(0).Object.assign},function(t,e,n){var r=n(18);r(r.S+r.F,"Object",{assign:n(28)})},function(t,e,n){var r=n(1),o=n(0),i=n(19),u=n(21),c=function(t,e,n){var a,f,s,l=t&c.F,p=t&c.G,d=t&c.S,v=t&c.P,h=t&c.B,y=t&c.W,m=p?o:o[e]||(o[e]={}),g=m.prototype,x=p?r:d?r[e]:(r[e]||{}).prototype;p&&(n=e);for(a in n)(f=!l&&x&&void 0!==x[a])&&a in m||(s=f?x[a]:n[a],m[a]=p&&"function"!=typeof x[a]?n[a]:h&&f?i(s,r):y&&x[a]==s?function(t){var e=function(e,n,r){if(this instanceof t){switch(arguments.length){case 0:return new t;case 1:return new t(e);case 2:return new t(e,n)}return new t(e,n,r)}return t.apply(this,arguments)};return e.prototype=t.prototype,e}(s):v&&"function"==typeof s?i(Function.call,s):s,v&&((m.virtual||(m.virtual={}))[a]=s,t&c.R&&g&&!g[a]&&u(g,a,s)))};c.F=1,c.G=2,c.S=4,c.P=8,c.B=16,c.W=32,c.U=64,c.R=128,t.exports=c},function(t,e,n){var r=n(20);t.exports=function(t,e,n){if(r(t),void 0===e)return t;switch(n){case 1:return function(n){return t.call(e,n)};case 2:return function(n,r){return t.call(e,n,r)};case 3:return function(n,r,o){return t.call(e,n,r,o)}}return function(){return t.apply(e,arguments)}}},function(t,e){t.exports=function(t){if("function"!=typeof t)throw TypeError(t+" is not a function!");return t}},function(t,e,n){var r=n(22),o=n(27);t.exports=n(3)?function(t,e,n){return r.f(t,e,o(1,n))}:function(t,e,n){return t[e]=n,t}},function(t,e,n){var r=n(23),o=n(24),i=n(26),u=Object.defineProperty;e.f=n(3)?Object.defineProperty:function(t,e,n){if(r(t),e=i(e,!0),r(n),o)try{return u(t,e,n)}catch(t){}if("get"in n||"set"in n)throw TypeError("Accessors not supported!");return"value"in n&&(t[e]=n.value),t}},function(t,e,n){var r=n(2);t.exports=function(t){if(!r(t))throw TypeError(t+" is not an object!");return t}},function(t,e,n){t.exports=!n(3)&&!n(4)(function(){return 7!=Object.defineProperty(n(25)("div"),"a",{get:function(){return 7}}).a})},function(t,e,n){var r=n(2),o=n(1).document,i=r(o)&&r(o.createElement);t.exports=function(t){return i?o.createElement(t):{}}},function(t,e,n){var r=n(2);t.exports=function(t,e){if(!r(t))return t;var n,o;if(e&&"function"==typeof(n=t.toString)&&!r(o=n.call(t)))return o;if("function"==typeof(n=t.valueOf)&&!r(o=n.call(t)))return o;if(!e&&"function"==typeof(n=t.toString)&&!r(o=n.call(t)))return o;throw TypeError("Can't convert object to primitive value")}},function(t,e){t.exports=function(t,e){return{enumerable:!(1&t),configurable:!(2&t),writable:!(4&t),value:e}}},function(t,e,n){"use strict";var r=n(29),o=n(40),i=n(41),u=n(42),c=n(6),a=Object.assign;t.exports=!a||n(4)(function(){var t={},e={},n=Symbol(),r="abcdefghijklmnopqrst";return t[n]=7,r.split("").forEach(function(t){e[t]=t}),7!=a({},t)[n]||Object.keys(a({},e)).join("")!=r})?function(t,e){for(var n=u(t),a=arguments.length,f=1,s=o.f,l=i.f;a>f;)for(var p,d=c(arguments[f++]),v=s?r(d).concat(s(d)):r(d),h=v.length,y=0;h>y;)l.call(d,p=v[y++])&&(n[p]=d[p]);return n}:a},function(t,e,n){var r=n(30),o=n(39);t.exports=Object.keys||function(t){return r(t,o)}},function(t,e,n){var r=n(31),o=n(5),i=n(33)(!1),u=n(36)("IE_PROTO");t.exports=function(t,e){var n,c=o(t),a=0,f=[];for(n in c)n!=u&&r(c,n)&&f.push(n);for(;e.length>a;)r(c,n=e[a++])&&(~i(f,n)||f.push(n));return f}},function(t,e){var n={}.hasOwnProperty;t.exports=function(t,e){return n.call(t,e)}},function(t,e){var n={}.toString;t.exports=function(t){return n.call(t).slice(8,-1)}},function(t,e,n){var r=n(5),o=n(34),i=n(35);t.exports=function(t){return function(e,n,u){var c,a=r(e),f=o(a.length),s=i(u,f);if(t&&n!=n){for(;f>s;)if((c=a[s++])!=c)return!0}else for(;f>s;s++)if((t||s in a)&&a[s]===n)return t||s||0;return!t&&-1}}},function(t,e,n){var r=n(8),o=Math.min;t.exports=function(t){return t>0?o(r(t),9007199254740991):0}},function(t,e,n){var r=n(8),o=Math.max,i=Math.min;t.exports=function(t,e){return t=r(t),t<0?o(t+e,0):i(t,e)}},function(t,e,n){var r=n(37)("keys"),o=n(38);t.exports=function(t){return r[t]||(r[t]=o(t))}},function(t,e,n){var r=n(1),o=r["__core-js_shared__"]||(r["__core-js_shared__"]={});t.exports=function(t){return o[t]||(o[t]={})}},function(t,e){var n=0,r=Math.random();t.exports=function(t){return"Symbol(".concat(void 0===t?"":t,")_",(++n+r).toString(36))}},function(t,e){t.exports="constructor,hasOwnProperty,isPrototypeOf,propertyIsEnumerable,toLocaleString,toString,valueOf".split(",")},function(t,e){e.f=Object.getOwnPropertySymbols},function(t,e){e.f={}.propertyIsEnumerable},function(t,e,n){var r=n(7);t.exports=function(t){return Object(r(t))}},function(e,n){e.exports=t}]).default}); \ No newline at end of file +!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e(require("AutoNumeric")):"function"==typeof define&&define.amd?define("VueAutonumeric",["AutoNumeric"],e):"object"==typeof exports?exports.VueAutonumeric=e(require("AutoNumeric")):t.VueAutonumeric=e(t.AutoNumeric)}("undefined"!=typeof self?self:this,function(t){return function(t){function e(r){if(n[r])return n[r].exports;var o=n[r]={i:r,l:!1,exports:{}};return t[r].call(o.exports,o,o.exports,e),o.l=!0,o.exports}var n={};return e.m=t,e.c=n,e.d=function(t,n,r){e.o(t,n)||Object.defineProperty(t,n,{configurable:!1,enumerable:!0,get:r})},e.n=function(t){var n=t&&t.__esModule?function(){return t.default}:function(){return t};return e.d(n,"a",n),n},e.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},e.p="",e(e.s=9)}([function(t,e){var n=t.exports={version:"2.5.3"};"number"==typeof __e&&(__e=n)},function(t,e){var n=t.exports="undefined"!=typeof window&&window.Math==Math?window:"undefined"!=typeof self&&self.Math==Math?self:Function("return this")();"number"==typeof __g&&(__g=n)},function(t,e){t.exports=function(t){return"object"==typeof t?null!==t:"function"==typeof t}},function(t,e,n){t.exports=!n(4)(function(){return 7!=Object.defineProperty({},"a",{get:function(){return 7}}).a})},function(t,e){t.exports=function(t){try{return!!t()}catch(t){return!0}}},function(t,e,n){var r=n(6),o=n(7);t.exports=function(t){return r(o(t))}},function(t,e,n){var r=n(32);t.exports=Object("z").propertyIsEnumerable(0)?Object:function(t){return"String"==r(t)?t.split(""):Object(t)}},function(t,e){t.exports=function(t){if(void 0==t)throw TypeError("Can't call method on "+t);return t}},function(t,e){var n=Math.ceil,r=Math.floor;t.exports=function(t){return isNaN(t=+t)?0:(t>0?r:n)(t)}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.VueAutonumeric=void 0;var r=n(10),o=function(t){return t&&t.__esModule?t:{default:t}}(r);"undefined"!=typeof window&&window.Vue&&Vue.component("vue-autonumeric",o.default),e.VueAutonumeric=o.default,e.default=o.default},function(t,e,n){var r=n(11)(n(12),null,null,null);t.exports=r.exports},function(t,e){t.exports=function(t,e,n,r){var o,i=t=t||{},u=typeof t.default;"object"!==u&&"function"!==u||(o=t,i=t.default);var c="function"==typeof i?i.options:i;if(e&&(c.render=e.render,c.staticRenderFns=e.staticRenderFns),n&&(c._scopeId=n),r){var a=Object.create(c.computed||null);Object.keys(r).forEach(function(t){var e=r[t];a[t]=function(){return e}}),c.computed=a}return{esModule:o,exports:i,options:c}}},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{default:t}}Object.defineProperty(e,"__esModule",{value:!0});var o=n(13),i=r(o),u=n(15),c=r(u),a=n(43),f=r(a),s={};e.default={name:"VueAutonumeric",render:function(t){var e="input"===this.tag,n=void 0;return n=e?{type:"text",placeholder:this.placeholder}:{contenteditable:!0},t(this.tag,{attrs:n,ref:"autoNumericElement",on:{keydown:this.setUserInteraction,paste:this.setUserInteraction,wheel:this.setUserInteraction,drop:this.setUserInteraction,keyup:this.resetUserInteraction,blur:this.resetUserInteraction,"autoNumeric:rawValueModified":this.updateVModel}})},props:{value:{type:Number,required:!1},options:{type:[Object,String,Array],required:!1,default:function(){return s}},resetOnOptions:{type:Boolean,required:!1,default:!0},placeholder:{type:String,required:!1},tag:{type:String,required:!1,default:"input"}},data:function(){return{anElement:null,userInteraction:!1}},mounted:function(){var t=this,e=void 0;if(Array.isArray(this.options)){var n={};this.options.forEach(function(r){e=t.manageOptionElement(r),n=(0,c.default)(n,e)}),e=n}else e=this.manageOptionElement(this.options);this.anElement=new f.default(this.$refs.autoNumericElement,e),null!==this.value&&""!==this.value&&(this.anElement.set(this.value),this.updateVModel(),this.resetUserInteraction())},computed:{anInfo:function(){return{value:this.value,options:this.options}}},methods:{updateVModel:function(t){null!==this.anElement&&this.$emit("input",this.anElement.getNumber(),t)},setUserInteraction:function(){this.userInteraction=!0},resetUserInteraction:function(){this.userInteraction=!1},manageOptionElement:function(t){var e=void 0;return"string"==typeof t||t instanceof String?void 0!==(e=f.default.getPredefinedOptions()[t])&&null!==e||(console.warn("The given pre-defined options ["+t+"] is not recognized by autoNumeric.\nSwitching back to the default options."),e=s):e=t,e}},watch:{anInfo:function(t,e){if(e.options&&(0,i.default)(t.options)!==(0,i.default)(e.options)){var n=void 0;if(this.resetOnOptions){Array.isArray(t.options)&&(t.options=f.default.mergeOptions(t.options));var r=this.anElement.getSettings().decimalPlacesRawValue,o=f.default._getOptionObject(t.options);n=o.decimalPlaces&&o.decimalPlaces>r?(0,c.default)({},f.default.getDefaultConfig(),o):(0,c.default)({},f.default.getDefaultConfig(),{decimalPlacesRawValue:r},o)}else n=t.options;this.anElement.update(n)}if(void 0!==t.value){try{this.userInteraction||t.value!==e.value&&this.anElement.set(t.value)}catch(t){console.error(t)}this.resetUserInteraction()}}}}},function(t,e,n){t.exports={default:n(14),__esModule:!0}},function(t,e,n){var r=n(0),o=r.JSON||(r.JSON={stringify:JSON.stringify});t.exports=function(t){return o.stringify.apply(o,arguments)}},function(t,e,n){t.exports={default:n(16),__esModule:!0}},function(t,e,n){n(17),t.exports=n(0).Object.assign},function(t,e,n){var r=n(18);r(r.S+r.F,"Object",{assign:n(28)})},function(t,e,n){var r=n(1),o=n(0),i=n(19),u=n(21),c=function(t,e,n){var a,f,s,l=t&c.F,p=t&c.G,d=t&c.S,v=t&c.P,h=t&c.B,y=t&c.W,m=p?o:o[e]||(o[e]={}),g=m.prototype,x=p?r:d?r[e]:(r[e]||{}).prototype;p&&(n=e);for(a in n)(f=!l&&x&&void 0!==x[a])&&a in m||(s=f?x[a]:n[a],m[a]=p&&"function"!=typeof x[a]?n[a]:h&&f?i(s,r):y&&x[a]==s?function(t){var e=function(e,n,r){if(this instanceof t){switch(arguments.length){case 0:return new t;case 1:return new t(e);case 2:return new t(e,n)}return new t(e,n,r)}return t.apply(this,arguments)};return e.prototype=t.prototype,e}(s):v&&"function"==typeof s?i(Function.call,s):s,v&&((m.virtual||(m.virtual={}))[a]=s,t&c.R&&g&&!g[a]&&u(g,a,s)))};c.F=1,c.G=2,c.S=4,c.P=8,c.B=16,c.W=32,c.U=64,c.R=128,t.exports=c},function(t,e,n){var r=n(20);t.exports=function(t,e,n){if(r(t),void 0===e)return t;switch(n){case 1:return function(n){return t.call(e,n)};case 2:return function(n,r){return t.call(e,n,r)};case 3:return function(n,r,o){return t.call(e,n,r,o)}}return function(){return t.apply(e,arguments)}}},function(t,e){t.exports=function(t){if("function"!=typeof t)throw TypeError(t+" is not a function!");return t}},function(t,e,n){var r=n(22),o=n(27);t.exports=n(3)?function(t,e,n){return r.f(t,e,o(1,n))}:function(t,e,n){return t[e]=n,t}},function(t,e,n){var r=n(23),o=n(24),i=n(26),u=Object.defineProperty;e.f=n(3)?Object.defineProperty:function(t,e,n){if(r(t),e=i(e,!0),r(n),o)try{return u(t,e,n)}catch(t){}if("get"in n||"set"in n)throw TypeError("Accessors not supported!");return"value"in n&&(t[e]=n.value),t}},function(t,e,n){var r=n(2);t.exports=function(t){if(!r(t))throw TypeError(t+" is not an object!");return t}},function(t,e,n){t.exports=!n(3)&&!n(4)(function(){return 7!=Object.defineProperty(n(25)("div"),"a",{get:function(){return 7}}).a})},function(t,e,n){var r=n(2),o=n(1).document,i=r(o)&&r(o.createElement);t.exports=function(t){return i?o.createElement(t):{}}},function(t,e,n){var r=n(2);t.exports=function(t,e){if(!r(t))return t;var n,o;if(e&&"function"==typeof(n=t.toString)&&!r(o=n.call(t)))return o;if("function"==typeof(n=t.valueOf)&&!r(o=n.call(t)))return o;if(!e&&"function"==typeof(n=t.toString)&&!r(o=n.call(t)))return o;throw TypeError("Can't convert object to primitive value")}},function(t,e){t.exports=function(t,e){return{enumerable:!(1&t),configurable:!(2&t),writable:!(4&t),value:e}}},function(t,e,n){"use strict";var r=n(29),o=n(40),i=n(41),u=n(42),c=n(6),a=Object.assign;t.exports=!a||n(4)(function(){var t={},e={},n=Symbol(),r="abcdefghijklmnopqrst";return t[n]=7,r.split("").forEach(function(t){e[t]=t}),7!=a({},t)[n]||Object.keys(a({},e)).join("")!=r})?function(t,e){for(var n=u(t),a=arguments.length,f=1,s=o.f,l=i.f;a>f;)for(var p,d=c(arguments[f++]),v=s?r(d).concat(s(d)):r(d),h=v.length,y=0;h>y;)l.call(d,p=v[y++])&&(n[p]=d[p]);return n}:a},function(t,e,n){var r=n(30),o=n(39);t.exports=Object.keys||function(t){return r(t,o)}},function(t,e,n){var r=n(31),o=n(5),i=n(33)(!1),u=n(36)("IE_PROTO");t.exports=function(t,e){var n,c=o(t),a=0,f=[];for(n in c)n!=u&&r(c,n)&&f.push(n);for(;e.length>a;)r(c,n=e[a++])&&(~i(f,n)||f.push(n));return f}},function(t,e){var n={}.hasOwnProperty;t.exports=function(t,e){return n.call(t,e)}},function(t,e){var n={}.toString;t.exports=function(t){return n.call(t).slice(8,-1)}},function(t,e,n){var r=n(5),o=n(34),i=n(35);t.exports=function(t){return function(e,n,u){var c,a=r(e),f=o(a.length),s=i(u,f);if(t&&n!=n){for(;f>s;)if((c=a[s++])!=c)return!0}else for(;f>s;s++)if((t||s in a)&&a[s]===n)return t||s||0;return!t&&-1}}},function(t,e,n){var r=n(8),o=Math.min;t.exports=function(t){return t>0?o(r(t),9007199254740991):0}},function(t,e,n){var r=n(8),o=Math.max,i=Math.min;t.exports=function(t,e){return t=r(t),t<0?o(t+e,0):i(t,e)}},function(t,e,n){var r=n(37)("keys"),o=n(38);t.exports=function(t){return r[t]||(r[t]=o(t))}},function(t,e,n){var r=n(1),o=r["__core-js_shared__"]||(r["__core-js_shared__"]={});t.exports=function(t){return o[t]||(o[t]={})}},function(t,e){var n=0,r=Math.random();t.exports=function(t){return"Symbol(".concat(void 0===t?"":t,")_",(++n+r).toString(36))}},function(t,e){t.exports="constructor,hasOwnProperty,isPrototypeOf,propertyIsEnumerable,toLocaleString,toString,valueOf".split(",")},function(t,e){e.f=Object.getOwnPropertySymbols},function(t,e){e.f={}.propertyIsEnumerable},function(t,e,n){var r=n(7);t.exports=function(t){return Object(r(t))}},function(e,n){e.exports=t}]).default}); \ No newline at end of file diff --git a/examples-src/App.vue b/examples-src/App.vue index 73b5b2e..94e1ea5 100644 --- a/examples-src/App.vue +++ b/examples-src/App.vue @@ -134,7 +134,7 @@
-
Modify the option to 'percentage3EUdec' then set a small value by clicking here. This fails since we do not use a single object to update both options and value at the same time, while the v-model is shared with components having different options.
+
Modify the option to 'percentageEU3dec' then set a small value by clicking here. This fails since we do not use a single object to update both options and value at the same time, while the v-model is shared with components having different options.
", "license": "MIT", @@ -11,8 +11,11 @@ "build:examples": "webpack --config build/webpack.examples.js", "build": "npm run build:debug && npm run build:release && npm run build:examples", "clean": "rimraf ./examples/js/examples.bundle.js", - "lint": "eslint --ext .js,.vue src examples-src build", - "lintfix": "eslint --fix --ext .js,.vue src examples-src build" + "lint": "eslint --ext .js,.vue src examples-src test/unit build", + "lintfix": "eslint --fix --ext .js,.vue src examples-src test/unit build", + "unit": "jest --config test/unit/jest.conf.js --coverage", + "watch": "jest --config test/unit/jest.conf.js --watchAll", + "test": "npm run unit" }, "main": "dist/vue-autonumeric.min.js", "readmeFilename": "README.md", @@ -42,9 +45,11 @@ "autonumeric": "^4.2.3" }, "devDependencies": { + "@vue/test-utils": "^1.0.0-beta.12", "autoprefixer": "^6.7.7", "babel-core": "^6.0.0", "babel-eslint": "^8.0.0", + "babel-jest": "^22.4.3", "babel-loader": "^7.1.2", "babel-plugin-transform-runtime": "^6.23.0", "babel-preset-env": "^1.4.0", @@ -60,10 +65,13 @@ "eslint-plugin-promise": "^3.5.0", "eslint-plugin-standard": "^3.0.1", "extract-text-webpack-plugin": "^3.0.0", + "jest": "^22.4.3", + "jest-serializer-vue": "^1.0.0", "node-sass": "^4.5.3", "rimraf": "^2.6.1", "sass-loader": "^6.0.6", "vue": "^2.2.6", + "vue-jest": "^2.2.1", "vue-loader": "^11.3.3", "vue-style-loader": "^3.0.0", "vue-template-compiler": "^2.2.6", diff --git a/src/components/VueAutonumeric.vue b/src/components/VueAutonumeric.vue index 9a2339c..462edb7 100644 --- a/src/components/VueAutonumeric.vue +++ b/src/components/VueAutonumeric.vue @@ -1,8 +1,8 @@