Skip to content
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

Use native setters in documentation examples #1948

Merged
merged 1 commit into from
Sep 13, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -98,13 +98,12 @@ module('Integration | Component | ArticleForm', function(hooks) {

test('it can edit an article', async function(assert) {
// 🔴 Don't do this
let article = this.server.create('article', {
this.article = this.server.create('article', {
title: 'Old title'
});
this.set('article', article);

await render(hbs`
<ArticleForm @article={{article}}>
<ArticleForm @article={{this.article}}>
`);

await fillIn('input', 'New title');
Expand All @@ -128,11 +127,10 @@ So, in the same way that you wouldn't create a model in your server-side framewo
```js
// 🔴 Don't do this
// `article` is a Mirage model. It should never be consumed directly by Ember code.
let article = this.server.create('article');
this.set('article', article);
this.article = this.server.create('article');

await render(hbs`
<ArticleForm @article={{article}}>
<ArticleForm @article={{this.article}}>
`);
```

Expand Down Expand Up @@ -160,11 +158,10 @@ module('Integration | Component | ArticleForm', function(hooks) {
title: 'Old title'
});
let store = this.owner.lookup('service:store');
let article = await store.findRecord('article', serverArticle.id);
this.set('article', article);
this.article = await store.findRecord('article', serverArticle.id);

await render(hbs`
<ArticleForm @article={{article}}>
<ArticleForm @article={{this.article}}>
`);

await fillIn('input', 'New title');
Expand Down Expand Up @@ -231,11 +228,10 @@ module('Integration | Component | ArticleForm', function(hooks) {
});
pushMirageIntoStore();
let store = this.owner.lookup('service:store');
let article = store.peekRecord('article', serverArticle.id);
this.set('article', article);
this.article = store.peekRecord('article', serverArticle.id);

await render(hbs`
<ArticleForm @article={{article}}>
<ArticleForm @article={{this.article}}>
`);

await fillIn('input', 'New title');
Expand Down