Test#registerAsyncHelper()

registerAsyncHelper (name, helperMethod) public

Defined in packages/ember-testing/lib/test/helpers.js:43
Available since 1.2.0

registerAsyncHelper is used to register an async test helper that will be injected when App.injectTestHelpers is called.

The helper method will always be called with the current Application as the first parameter.

For example:

Ember.Test.registerAsyncHelper('boot', function(app) {
  Ember.run(app, app.advanceReadiness);
});

The advantage of an async helper is that it will not run until the last async helper has completed. All async helpers after it will wait for it complete before running.

For example:

Ember.Test.registerAsyncHelper('deletePost', function(app, postId) {
  click('.delete-' + postId);
});

// ... in your test
visit('/post/2');
deletePost(2);
visit('/post/3');
deletePost(3);

Parameters:

name String
The name of the helper method to add.
helperMethod Function
doc_EmberJs
2016-11-30 16:53:42
Comments
Leave a Comment

Please login to continue.