Skip to content

Commit 0a9a518

Browse files
authored
Merge pull request #33 from pzuraq/inputmask-3.3.6
Bump Inputmask to 3.3.6, fix imports and tests
2 parents f7f2389 + f5acb83 commit 0a9a518

13 files changed

+626
-54
lines changed

addon/components/input-mask.js

+1-4
Original file line numberDiff line numberDiff line change
@@ -93,13 +93,10 @@ export default Ember.TextField.extend({
9393
// in another function.
9494
updateMask: function() {
9595
if (this.get('mask').toLowerCase() === 'regex') {
96-
// Regex has to capitalized for the plugin, but that's annoying
97-
// so let's just allow users to enter it however they want...
98-
this.set('mask', 'Regex');
99-
10096
// Note: I like pattern better, but I'll leave regex in as an option
10197
// as well since that's what the plugin defines on the options hash
10298
this.set('options.regex', this.get('pattern') || this.get('regex'));
99+
this.set('options.mask', '');
103100
}
104101

105102
this.setProperties({

index.js

+9-11
Original file line numberDiff line numberDiff line change
@@ -5,29 +5,27 @@ module.exports = {
55
name: 'ember-inputmask',
66
options: {
77
nodeAssets: {
8-
'jquery.inputmask': {
8+
'inputmask': {
99
vendor: [
10-
'extra/dependencyLibs/inputmask.dependencyLib.js',
10+
'dist/inputmask/dependencyLibs/inputmask.dependencyLib.js',
1111
'dist/inputmask/inputmask.js',
1212
'dist/inputmask/inputmask.extensions.js',
1313
'dist/inputmask/inputmask.date.extensions.js',
1414
'dist/inputmask/inputmask.numeric.extensions.js',
15-
'dist/inputmask/inputmask.phone.extensions.js',
16-
'dist/inputmask/inputmask.regex.extensions.js'
15+
'dist/inputmask/inputmask.phone.extensions.js'
1716
]
1817
}
1918
}
2019
},
2120
included() {
2221
this._super.included.apply(this, arguments);
2322
if (!process.env.EMBER_CLI_FASTBOOT) {
24-
this.import('vendor/jquery.inputmask/extra/dependencyLibs/inputmask.dependencyLib.js');
25-
this.import('vendor/jquery.inputmask/dist/inputmask/inputmask.js');
26-
this.import('vendor/jquery.inputmask/dist/inputmask/inputmask.extensions.js');
27-
this.import('vendor/jquery.inputmask/dist/inputmask/inputmask.date.extensions.js');
28-
this.import('vendor/jquery.inputmask/dist/inputmask/inputmask.numeric.extensions.js');
29-
this.import('vendor/jquery.inputmask/dist/inputmask/inputmask.phone.extensions.js');
30-
this.import('vendor/jquery.inputmask/dist/inputmask/inputmask.regex.extensions.js');
23+
this.import('vendor/inputmask/dist/inputmask/dependencyLibs/inputmask.dependencyLib.js');
24+
this.import('vendor/inputmask/dist/inputmask/inputmask.js');
25+
this.import('vendor/inputmask/dist/inputmask/inputmask.extensions.js');
26+
this.import('vendor/inputmask/dist/inputmask/inputmask.date.extensions.js');
27+
this.import('vendor/inputmask/dist/inputmask/inputmask.numeric.extensions.js');
28+
this.import('vendor/inputmask/dist/inputmask/inputmask.phone.extensions.js');
3129
}
3230
}
3331
};

package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
"dependencies": {
2121
"ember-cli-babel": "^5.1.7",
2222
"ember-cli-node-assets": "^0.2.2",
23-
"jquery.inputmask": "3.3.4"
23+
"inputmask": "3.3.6"
2424
},
2525
"devDependencies": {
2626
"broccoli-asset-rev": "^2.4.5",
@@ -38,7 +38,7 @@
3838
"ember-disable-prototype-extensions": "^1.1.0",
3939
"ember-export-application-global": "^1.0.5",
4040
"ember-load-initializers": "^0.6.0",
41-
"ember-native-dom-helpers": "^0.3.2",
41+
"ember-native-dom-helpers": "^0.4.0",
4242
"ember-resolver": "2.0.3",
4343
"ember-source": "~2.12.0",
4444
"loader.js": "^4.2.3"

tests/integration/credit-card-input-test.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { moduleForComponent, test } from 'ember-qunit';
22
import hbs from 'htmlbars-inline-precompile';
3-
import { fillIn, find, triggerEvent } from 'ember-native-dom-helpers/test-support/helpers';
3+
import { fillIn, find, triggerEvent } from 'ember-native-dom-helpers';
44

55
moduleForComponent('credit-card-input', 'Integration | Component | credit-card-input', {
66
integration: true

tests/integration/currency-input-test.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { moduleForComponent, test } from 'ember-qunit';
22
import hbs from 'htmlbars-inline-precompile';
3-
import { fillIn, find, triggerEvent } from 'ember-native-dom-helpers/test-support/helpers';
3+
import { fillIn, find, triggerEvent } from 'ember-native-dom-helpers';
44

55
moduleForComponent('currency-input', 'Integration | Component | currency-input', {
66
integration: true
@@ -10,7 +10,7 @@ test('default value', function(assert) {
1010
this.render(hbs`{{currency-input unmaskedValue=unmaskedValue}}`);
1111
triggerEvent('input', 'blur');
1212
assert.equal(find('input').value, '$ 0.00');
13-
assert.equal(this.unmaskedValue, '');
13+
assert.equal(this.unmaskedValue, '0.00');
1414
});
1515

1616
test('filled-in value', function(assert) {

tests/integration/date-input-test.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { moduleForComponent, test } from 'ember-qunit';
22
import hbs from 'htmlbars-inline-precompile';
3-
import { fillIn, find, triggerEvent } from 'ember-native-dom-helpers/test-support/helpers';
3+
import { fillIn, find, triggerEvent } from 'ember-native-dom-helpers';
44

55
moduleForComponent('date-input', 'Integration | Component | date-input', {
66
integration: true

tests/integration/email-input-test.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { moduleForComponent, test } from 'ember-qunit';
22
import hbs from 'htmlbars-inline-precompile';
3-
import { fillIn, find, triggerEvent } from 'ember-native-dom-helpers/test-support/helpers';
3+
import { fillIn, find, triggerEvent } from 'ember-native-dom-helpers';
44

55
moduleForComponent('email-input', 'Integration | Component | email-input', {
66
integration: true

tests/integration/input-mask-test.js

+15-13
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,36 @@
11
import { moduleForComponent, test } from 'ember-qunit';
22
import hbs from 'htmlbars-inline-precompile';
3-
import { fillIn, find, triggerEvent } from 'ember-native-dom-helpers/test-support/helpers';
3+
import { fillIn, find, triggerEvent } from 'ember-native-dom-helpers';
44

55
moduleForComponent('input-mask', 'Integration | Component | input-mask', {
66
integration: true
77
});
88

99
test('regex with invalid value', function(assert) {
1010
this.render(hbs`{{input-mask unmaskedValue=unmaskedValue mask='regex'
11-
pattern='you_can_only_type_thi[s]+'}}`);
12-
fillIn('input', 'test');
11+
pattern='[a-z]+ is [0-9]*'}}`);
12+
fillIn('input', '42');
1313
triggerEvent('input', 'blur');
1414
assert.equal(find('input').value, '');
1515
assert.equal(this.unmaskedValue, '');
1616
});
1717

1818
test('regex with valid value', function(assert) {
1919
this.render(hbs`{{input-mask unmaskedValue=unmaskedValue mask='regex'
20-
pattern='you_can_only_type_thi[s]+'}}`);
21-
fillIn('input', 'you_can_only_type_this');
20+
pattern='[a-z]+ is [0-9]*'}}`);
21+
fillIn('input', 'answer is 42');
2222
triggerEvent('input', 'blur');
23-
assert.equal(find('input').value, 'you_can_only_type_this');
24-
assert.equal(this.unmaskedValue, 'you_can_only_type_this');
23+
assert.equal(find('input').value, 'answer is 42');
24+
assert.equal(this.unmaskedValue, 'answer42');
2525
});
2626

2727
test('regex with another valid value', function(assert) {
2828
this.render(hbs`{{input-mask unmaskedValue=unmaskedValue mask='regex'
29-
pattern='you_can_only_type_thi[s]+'}}`);
30-
fillIn('input', 'you_can_only_type_thisssss');
29+
pattern='[a-z]+ is [0-9]*'}}`);
30+
fillIn('input', 'question is ?');
3131
triggerEvent('input', 'blur');
32-
assert.equal(find('input').value, 'you_can_only_type_thisssss');
33-
assert.equal(this.unmaskedValue, 'you_can_only_type_thisssss');
32+
assert.equal(find('input').value, 'question is ');
33+
assert.equal(this.unmaskedValue, 'question');
3434
});
3535

3636
test('showMaskOnHover=true (default) works', function(assert) {
@@ -49,14 +49,16 @@ test('showMaskOnHover=false works', function(assert) {
4949
});
5050

5151
test('showMaskOnFocus=true (default) works', function(assert) {
52-
this.render(hbs`{{input-mask unmaskedValue=unmaskedValue mask='9-9+9'}}`);
52+
this.render(hbs`{{input-mask unmaskedValue=unmaskedValue mask='9-9+9'
53+
showMaskOnHover=false}}`);
5354
triggerEvent('input', 'focus');
5455
assert.equal(find('input').value, '_-_+_');
5556
});
5657

5758
test('showMaskOnFocus=false works', function(assert) {
5859
this.render(hbs`{{input-mask unmaskedValue=unmaskedValue mask='9-9+9'
59-
showMaskOnFocus=false}}`);
60+
showMaskOnFocus=false showMaskOnHover=false}}`);
61+
triggerEvent('input', 'mouseenter');
6062
triggerEvent('input', 'focus');
6163
assert.equal(find('input').value, '');
6264
});

tests/integration/number-input-test.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { moduleForComponent, test } from 'ember-qunit';
22
import hbs from 'htmlbars-inline-precompile';
3-
import { fillIn, find, triggerEvent } from 'ember-native-dom-helpers/test-support/helpers';
3+
import { fillIn, find, triggerEvent } from 'ember-native-dom-helpers';
44

55
moduleForComponent('number-input', 'Integration | Component | number-input', {
66
integration: true

tests/integration/phone-number-input-test.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { moduleForComponent, test } from 'ember-qunit';
22
import hbs from 'htmlbars-inline-precompile';
3-
import { fillIn, find, triggerEvent } from 'ember-native-dom-helpers/test-support/helpers';
3+
import { fillIn, find, triggerEvent } from 'ember-native-dom-helpers';
44

55
moduleForComponent('phone-number-input', 'Integration | Component | phone-number-input', {
66
integration: true

tests/integration/ssn-input-test.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { moduleForComponent, test } from 'ember-qunit';
22
import hbs from 'htmlbars-inline-precompile';
3-
import { fillIn, find, triggerEvent } from 'ember-native-dom-helpers/test-support/helpers';
3+
import { fillIn, find, triggerEvent } from 'ember-native-dom-helpers';
44

55
moduleForComponent('ssn-input', 'Integration | Component | ssn-input', {
66
integration: true

tests/integration/zip-code-input-test.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { moduleForComponent, test } from 'ember-qunit';
22
import hbs from 'htmlbars-inline-precompile';
3-
import { fillIn, find, triggerEvent } from 'ember-native-dom-helpers/test-support/helpers';
3+
import { fillIn, find, triggerEvent } from 'ember-native-dom-helpers';
44

55
moduleForComponent('zip-code-input', 'Integration | Component | zip-code-input', {
66
integration: true

0 commit comments

Comments
 (0)