-
-
Notifications
You must be signed in to change notification settings - Fork 259
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
Ensure typeIn
does not await settled()
after each event
#707
Ensure typeIn
does not await settled()
after each event
#707
Conversation
I figured out a way to fix this, by optionally returning settled from |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for working on this @jakebixbyavalara! I've pushed a commit that tweaks the fix a bit (avoids requiring us to add an additional boolean argument to the main triggerKeyEvent
function). Please take a look when you have a chance...
@rwjblue That works for me, I appreciate the refactor! |
@rwjblue just wanted to check in, did you need me to do any additional work on this PR? |
… debounce and timeout
Moves the bulk of the actual event firing logic of `triggerKeyEvent` into a separate function that can be used by our other helper functions (e.g. `typeIn`) without incorporating `await settled()` directly. Does **not** change the fundamental mechanism that makes `typeIn` work, but does ensure that we do not wait for all settledness checks to fire before continueing to fire typing events.
710f1b8
to
1c365f3
Compare
We had an issue with Node 6 that we just resolved. I just rebased on top of those fixes, and I think that CI should be happy now... Assuming it is, we can land and release. |
typeIn
does not await settled()
after each event
The current behavior of the
typeIn
helper waits for settled promises between text inputs/key events. This is not ideal because it prevents the helper from being used for testing things like debounced functions (like in a typeahead component for instance).Here is a repro repo demonstrating the issue., I originally encountered the behavior using an
ember-concurrency
timeout
to debounce a task, which worked fine in the app, but began failing in test due to the change to thetriggerKeyEvent
helper.This PR fixes the issue by making the
triggerKeyEvent
helper optionally wait for settled promises via a boolean. It's a simple fix that may be overlooking something, so please let me know if there would be a more preferred solution.Initial PR text (when it was just a failing test PR):