From a226803f3c39f55b8430281946998eeb328add78 Mon Sep 17 00:00:00 2001 From: Matt Gardner Date: Fri, 24 Apr 2020 22:57:18 -0400 Subject: [PATCH] Use native setters in documentation examples --- .../testing/integration-and-unit-tests.md | 20 ++++++++----------- 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/packages/ember-cli-mirage-docs/app/templates/docs/testing/integration-and-unit-tests.md b/packages/ember-cli-mirage-docs/app/templates/docs/testing/integration-and-unit-tests.md index 9e4b90cc0..d82ab8071 100644 --- a/packages/ember-cli-mirage-docs/app/templates/docs/testing/integration-and-unit-tests.md +++ b/packages/ember-cli-mirage-docs/app/templates/docs/testing/integration-and-unit-tests.md @@ -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` - + `); await fillIn('input', 'New title'); @@ -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` - + `); ``` @@ -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` - + `); await fillIn('input', 'New title'); @@ -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` - + `); await fillIn('input', 'New title');