-
Notifications
You must be signed in to change notification settings - Fork 37
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
triggerEvent(form, 'reset') event does not seem to work #110
Comments
Huh, that definitely seems odd. I think the first step here would be to reproduce the issue in a failing test here to the addon. I'm happy to dig into this deeper if you can submit a failing test PR... |
I wrote a test: test('It fires form.reset events', async function(assert) {
assert.expect(3);
this.onReset = (e) => {
assert.ok(true, 'a reset event is fired');
assert.ok(e instanceof window.Event, 'It receives a native event');
// NB this line:
assert.equal(document.querySelector('.target-input').value, 'original value', 'resets the form');
};
this.render(hbs`
<form onreset={{onReset}} class="target-form" >
<input value="default value" class="target-input">
</form>`);
await fillIn('.target-input', 'new value');
await triggerEvent('.target-form', 'reset');
}); The key "failure" is that the form doesn't actually reset when you fire a reset event. But I'm not sure it should. It does when you call You can test out the differences in this fiddle. |
I have a test that looks like
But the
reset
doesn't seem to fire.The test works if I change that line to
or to
The text was updated successfully, but these errors were encountered: