-
-
Notifications
You must be signed in to change notification settings - Fork 255
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
Expose settled
helper function.
#223
Conversation
* Rename `wait` to `settled` * Ensure existing `import wait from 'ember-test-helpers/wait'` code works properly * Export `settled` as public API from the main `index.js` * Move existing `wait` tests into `legacy-0-6-x` folder Primary reasoning for the rename from `wait` to `settled`: ```js test('can do xyz', async function(assert) { await this.render(hbs`{{some-thing}}`); await click('.some-thing'); await wait(); // <- WAT?!?!!? }); ``` This looks much better: ```js test('can do xyz', async function(assert) { await this.render(hbs`{{some-thing}}`); await click('.some-thing'); await settled(); }); ```
913c171
to
568600c
Compare
568600c
to
4d9d28a
Compare
addon-test-support/settled.js
Outdated
let waitForWaiters = options.hasOwnProperty('waitForWaiters') ? options.waitForWaiters : true; | ||
|
||
return new EmberPromise(function(resolve) { | ||
let watcher = self.setInterval(function() { |
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.
should this use the new ./global
util instead of self
?
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.
Definitely, will update.
_setupPromiseListeners, | ||
_teardownAJAXHooks, | ||
_teardownPromiseListeners, | ||
} from './settled'; |
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.
this is fine for now, I'm just wondering if we should deprecate importing this module at some point?
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.
Ya, totally agreed. Basically, I want to introduce all the new functionality without deprecating anything at first. Then as we get more sure of the new system (e.g. after a little while of using the new API’s by default) we add in all the deprecations.
I want to be very careful about deprecation spew leading in to Ember 3.0...
}); | ||
|
||
test('it waits for Ember test waiters', async function(assert) { | ||
await this.render(hbs`{{x-test-5}}`); |
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.
since render()
without this
is apparently meant to be the documented default should we use it here too?
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.
Ya, but I didn’t want to do that here since I wasn’t sure how you felt about the other PR yet.
wait
tosettled
import wait from 'ember-test-helpers/wait'
code works properlysettled
as public API from the mainindex.js
.wait
tests intolegacy-0-6-x
folderwait
tests to the new API style (setupRenderingContext
, async/await, etc)The primary reasoning for the rename from
wait
tosettled
:This looks much better: