Skip to content

Commit a25551c

Browse files
committed
Add failing test case to reproduce behaviour
Closes adopted-ember-addons#143
1 parent 0c47545 commit a25551c

File tree

1 file changed

+31
-0
lines changed

1 file changed

+31
-0
lines changed

tests/integration/components/one-way-input-mask-test.js

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,5 +109,36 @@ module('Integration | Component | one-way-input-mask', function(hooks) {
109109

110110
await fillIn('input', '155');
111111
assert.dom('input').hasValue('15');
112+
});
113+
114+
test('Inputs value correcly even when input have multiple masks', async function(assert) {
115+
this.set('masks', ['9.9.9', '99.9-9']);
116+
this.set('data', null);
117+
this.set('update', (unmasked) => {
118+
this.set('data', unmasked)
119+
})
120+
121+
await render(hbs`<OneWayInputMask @value={{data}} @mask={{this.masks}} @update={{update}} />`);
122+
123+
await focus('input');
124+
await triggerKeyEvent('input', 'keypress', '1');
125+
await triggerKeyEvent('input', 'keydown', '1');
126+
await triggerKeyEvent('input', 'keyup', '1');
127+
128+
await triggerKeyEvent('input', 'keypress', '3');
129+
await triggerKeyEvent('input', 'keydown', '3');
130+
await triggerKeyEvent('input', 'keyup', '3');
131+
132+
await triggerKeyEvent('input', 'keypress', '4');
133+
await triggerKeyEvent('input', 'keydown', '4');
134+
await triggerKeyEvent('input', 'keyup', '4');
135+
136+
assert.dom('input').hasValue("1.3.4");
137+
138+
await triggerKeyEvent('input', 'keypress', '5');
139+
await triggerKeyEvent('input', 'keydown', '5');
140+
await triggerKeyEvent('input', 'keyup', '5');
141+
142+
assert.dom('input').hasValue("13.4-5");
112143
});
113144
});

0 commit comments

Comments
 (0)