Skip to content
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

feat: export our own async version of fireEvent #3

Merged
merged 2 commits into from
Jul 30, 2019

Conversation

mlrawlings
Copy link
Member

Description

The promise returned from fireEvent resolves once any pending updates caused by the event have completed (currently uses wait() to accomplish this).

BREAKING CHANGE: fireEvent no longer returns a boolean and instead returns a promise.

Motivation and Context

Since DOM updates are async in Marko, all assertions following an event needed to wait for a DOM change themselves.

fireEvent.click(someNode);
wait(() => expect(someNode).to.have.attr("newAttr"));

Now, you can wait for the effect of a fireEvent method:

await fireEvent.click(someNode);
expect(someNode).to.have.attr("newAttr");

Checklist:

  • I have updated/added documentation affected by my changes.
  • I have added tests to cover my changes.

The promise returned from fireEvent resolves once any pending updates
caused by the event have completed.

BREAKING CHANGE: fireEvent no longer returns a boolean and instead
returns a promise.
@DylanPiercey DylanPiercey merged commit 7ff8fbe into master Jul 30, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants