Skip to content

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Kryazhev Alexey committed Sep 19, 2017
1 parent d13cbb9 commit 8c90fde
Show file tree
Hide file tree
Showing 14 changed files with 1,631 additions and 1,627 deletions.
1,600 changes: 800 additions & 800 deletions dist/imask.es.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/imask.es.js.map

Large diffs are not rendered by default.

1,600 changes: 800 additions & 800 deletions dist/imask.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/imask.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/imask.min.es.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/imask.min.es.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/imask.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/imask.min.js.map

Large diffs are not rendered by default.

7 changes: 7 additions & 0 deletions karma.conf.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
var resolve = require('rollup-plugin-node-resolve');
var commonjs = require('rollup-plugin-commonjs');
var babel = require('rollup-plugin-babel');


Expand Down Expand Up @@ -30,6 +32,11 @@ module.exports = function (config) {
browsers: ['Chrome'],
rollupPreprocessor: {
plugins: [
resolve({
jsnext: true,
main: true
}),
commonjs(),
babel({
exclude: 'node_modules/**',
})
Expand Down
14 changes: 8 additions & 6 deletions src/masked/factory.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
import {isString} from '../core/utils';
import Masked from './base';
import MaskedNumber from './number';


export default
Expand All @@ -7,23 +9,23 @@ function createMask (opts) {

const mask = opts.mask;

if (mask instanceof IMask.Masked) {
if (mask instanceof Masked) {
return mask;
}
if (mask instanceof RegExp) {
opts.validate = (value) => mask.test(value);
return new IMask.Masked(opts);
return new Masked(opts);
}
if (isString(mask)) {
return new IMask.MaskedPattern(opts);
}
if (mask.prototype instanceof IMask.Masked) {
if (mask.prototype instanceof Masked) {
delete opts.mask;
return new mask(opts);
}
if (mask instanceof Number || typeof mask === 'number' || mask === Number) {
delete opts.mask;
return new IMask.MaskedNumber(opts);
return new MaskedNumber(opts);
}
if (mask instanceof Date || mask === Date) {
delete opts.mask;
Expand All @@ -35,9 +37,9 @@ function createMask (opts) {
}
if (mask instanceof Function){
opts.validate = mask;
return new IMask.Masked(opts);
return new Masked(opts);
}

console.warn('Mask not found for', opts); // eslint-disable-line no-console
return new IMask.Masked(opts);
return new Masked(opts);
}
1 change: 1 addition & 0 deletions test/imask.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
import IMask from '../src/imask';
8 changes: 3 additions & 5 deletions test/masked/pattern/cursor.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
import PatternMasked from '../../../src/masked/pattern';
import MaskedPattern from '../../../src/masked/pattern';


describe('Align left', function () {
const mask = new PatternMasked({
const mask = new MaskedPattern({
mask: '',
placeholder: {
show: 'always'
}
placeholder: {lazy: false}
});

beforeEach(function () {
Expand Down
8 changes: 3 additions & 5 deletions test/masked/pattern/extract.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
import PatternMasked from '../../../src/masked/pattern';
import MaskedPattern from '../../../src/masked/pattern';


describe('Extract', function () {
const mask = new PatternMasked({
const mask = new MaskedPattern({
mask: '',
placeholder: {
show: 'always'
}
placeholder: {lazy: false}
});

beforeEach(function () {
Expand Down
8 changes: 3 additions & 5 deletions test/masked/pattern/insert.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
import PatternMasked from '../../../src/masked/pattern';
import MaskedPattern from '../../../src/masked/pattern';


describe('Insert', function () {
const mask = new PatternMasked({
const mask = new MaskedPattern({
mask: '',
placeholder: {
show: 'always'
}
placeholder: {lazy: false}
});

beforeEach(function () {
Expand Down

0 comments on commit 8c90fde

Please sign in to comment.