emberjs/ember.js — pull request #2932 by teddyzeenny (2013-07-01 18:34:49+00:00)
Title: Ember.Test Helpers no longer need to be chained

Removes the need for ember-testing helpers to be chained. Based on the proposal in [Discourse](http://discuss.emberjs.com/t/ember-testing-improvements/1652)

```javascript

visit('posts/new');
click('.add-btn');
fillIn('.title', 'Post');
click('.submit');

andThen(function() {
equal(find('.post-title'), 'Post');
});

visit('comments');

andThen(function() {
equal(find('.comments').length, 0);
});
```

The PR also allows custom helpers to use async helpers without chaining:

```javascript
Ember.Test.registerHelper('deletePost', function(app, postId) {
visit('/post/' + postId);
click('.delete-btn');
});
```

Then in your test:

```javascript
deletePost(1);

andThen(function() {
equal(find('.post').length, 0);
});
````

This commit keeps the chaining for backwards compatibility.

**Breaking Change**:

Helpers that are not async and need to return an immediate value (such as `find`)
should have the option `{ wait: false }` passed on registration.

```javascript
function findPost() {
return find('.post');
}

Ember.Test.registerHelper('findPost', findPost, { wait: false });
```

cc @stefanpenner, @wycats