Skip to content

Commit

Permalink
refactor focus input test
Browse files Browse the repository at this point in the history
  • Loading branch information
snewcomer committed Nov 20, 2021
1 parent 9475d05 commit bbb6b82
Showing 1 changed file with 21 additions and 28 deletions.
49 changes: 21 additions & 28 deletions tests/unit/setup-rendering-context-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -440,34 +440,27 @@ module('setupRenderingContext', function (hooks) {
assert.equal(this.get('value'), '1');
});

// test('it supports dom triggered focus events', async function (assert) {
// this.owner.register(
// 'component:my-input',
// TextField.extend({
// init() {
// this._super(...arguments);

// this.set('value', 'init');
// },
// focusIn() {
// this.set('value', 'focusin');
// },
// focusOut() {
// this.set('value', 'focusout');
// },
// })
// );
// await this.render(hbs`{{my-input}}`);

// let input = this.element.querySelector('input');
// assert.equal(input.value, 'init');

// await focus(input);
// assert.equal(input.value, 'focusin');

// await blur(input);
// assert.equal(input.value, 'focusout');
// });
test('it supports dom triggered focus events', async function (assert) {
this.owner.register(
'template:components/x-input',
hbs`<input onblur={{this.onBlur}} onfocusout={{this.onFocus}} />`
);
await render(hbs`<XInput />`);

let input = this.element.querySelector('input');
input.addEventListener ('blur', () => {
assert.step('blur');
});

input.addEventListener('focus', () => {
assert.step('focus');
});

await focus(input);
await blur(input);

assert.verifySteps(['focus', 'blur']);
});

test('two way bound arguments are updated', async function (assert) {
this.owner.register(
Expand Down

0 comments on commit bbb6b82

Please sign in to comment.