Skip to content

Commit

Permalink
Update per mistahenry feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
Ruslan Hrabovyi committed Dec 2, 2018
1 parent d06d06f commit ca6b0a8
Showing 1 changed file with 30 additions and 14 deletions.
44 changes: 30 additions & 14 deletions guides/async-await.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ title: Migrating to async/await
---
{% raw %}

If you migrate to `"@ember/test-helpers"` you should take care to update all your "actions" usages to leaverage `async`/`await` syntax.
When migrating to use `"@ember/test-helpers"`, you should take care to update all your "actions" usages to leverage `async`/`await` syntax.

## Manual steps

Expand Down Expand Up @@ -33,35 +33,51 @@ Custom methods using actions should also become async:
**Bad**
```js
export default {
scope,
scope: 'form.login-form',

username: {
scope: '[name=usename]'
},

password: {
scope: '[type=password]'
},

username: fillable('[name=usename]'),
password: fillable('[type=password]'),
submit: clickable('button'),

login(username, password) {
this.visit('/login')
.username(username)
.password(password)
.submit();
this.visit('/login');

this.username.fillIn(username);
this.password.fillIn(password);

return this.submit();
}
}
```

**Good**
```js
export default {
scope,
scope: 'form.login-form',

username: {
scope: '[name=usename]'
},

password: {
scope: '[type=password]'
},

username: fillable('[name=usename]'),
password: fillable('[type=password]'),
submit: clickable('button'),

async login(username, password) {
await this.visit('/login');
.username(username)
.password(password)
.submit();

await this.username.fillIn(username)
await this.password.fillIn(password)

return this.submit();
}
}
```
Expand Down

0 comments on commit ca6b0a8

Please sign in to comment.