diff --git a/ember-ui/app/components/recipe-add.hbs b/ember-ui/app/components/meal-add.hbs similarity index 64% rename from ember-ui/app/components/recipe-add.hbs rename to ember-ui/app/components/meal-add.hbs index 7736c6b..e7405b5 100644 --- a/ember-ui/app/components/recipe-add.hbs +++ b/ember-ui/app/components/meal-add.hbs @@ -1,10 +1,10 @@ -{{#if this.fetchRecipe.isRunning}} +{{#if this.fetchMeal.isRunning}} {{/if}} diff --git a/ember-ui/app/components/recipe-add.js b/ember-ui/app/components/meal-add.js similarity index 68% rename from ember-ui/app/components/recipe-add.js rename to ember-ui/app/components/meal-add.js index b8a5518..594c7a0 100644 --- a/ember-ui/app/components/recipe-add.js +++ b/ember-ui/app/components/meal-add.js @@ -3,15 +3,15 @@ import { inject as service } from '@ember/service'; import { task } from 'ember-concurrency'; import { action } from "@ember/object"; -export default class RecipeAddComponent extends Component { +export default class MealAddComponent extends Component { @service store; @(task(function * () { return yield this.store.queryRecord('meal', 'random'); - })) fetchRecipe; + })) fetchMeal; @action - async addRecipe() { - await this.fetchRecipe.perform(); + async addMeal() { + await this.fetchMeal.perform(); } } diff --git a/ember-ui/app/components/recipe-preview.hbs b/ember-ui/app/components/meal-item.hbs similarity index 73% rename from ember-ui/app/components/recipe-preview.hbs rename to ember-ui/app/components/meal-item.hbs index faca852..3560c8f 100644 --- a/ember-ui/app/components/recipe-preview.hbs +++ b/ember-ui/app/components/meal-item.hbs @@ -1,18 +1,18 @@ - +
- +
-
+
{{@meal.name}}
-

+

{{@meal.ingredientsList}}

-
+
{{@meal.category}} {{@meal.area}}
diff --git a/ember-ui/app/components/recipe-list.hbs b/ember-ui/app/components/meal-list.hbs similarity index 75% rename from ember-ui/app/components/recipe-list.hbs rename to ember-ui/app/components/meal-list.hbs index 0c580cd..a19296a 100644 --- a/ember-ui/app/components/recipe-list.hbs +++ b/ember-ui/app/components/meal-list.hbs @@ -6,10 +6,10 @@ {{#each group.model as |meal|}} - + {{/each}} diff --git a/ember-ui/app/components/recipe-list.js b/ember-ui/app/components/meal-list.js similarity index 92% rename from ember-ui/app/components/recipe-list.js rename to ember-ui/app/components/meal-list.js index fd8ba04..de0f47d 100644 --- a/ember-ui/app/components/recipe-list.js +++ b/ember-ui/app/components/meal-list.js @@ -4,7 +4,7 @@ import { action } from "@ember/object"; import { A } from '@ember/array'; import { inject as service } from '@ember/service'; -export default class RecipeListComponent extends Component { +export default class MealListComponent extends Component { @service store; @tracked items = A([]); diff --git a/ember-ui/tests/integration/components/recipe-add-test.js b/ember-ui/tests/integration/components/meal-add-test.js similarity index 67% rename from ember-ui/tests/integration/components/recipe-add-test.js rename to ember-ui/tests/integration/components/meal-add-test.js index 27a4b4d..4444c31 100644 --- a/ember-ui/tests/integration/components/recipe-add-test.js +++ b/ember-ui/tests/integration/components/meal-add-test.js @@ -4,15 +4,15 @@ import { setupMirage } from 'ember-cli-mirage/test-support'; import { render, click } from '@ember/test-helpers'; import { hbs } from 'ember-cli-htmlbars'; -module('Integration | Component | recipe-add', function(hooks) { +module('Integration | Component | meal-add', function(hooks) { setupRenderingTest(hooks); setupMirage(hooks); - test('it adds a new recipe (meal) when button is clicked', async function(assert) { - await render(hbs``); + test('it adds a new meal (meal) when button is clicked', async function(assert) { + await render(hbs``); let store = this.owner.lookup('service:store'); - await click('[data-test-id=recipe-add-button]'); + await click('[data-test-id=meal-add-button]'); let randomMeal = await store.findRecord('meal', 'random'); assert.ok(randomMeal); diff --git a/ember-ui/tests/integration/components/recipe-preview-test.js b/ember-ui/tests/integration/components/meal-item-test.js similarity index 56% rename from ember-ui/tests/integration/components/recipe-preview-test.js rename to ember-ui/tests/integration/components/meal-item-test.js index f039475..9ed2fe3 100644 --- a/ember-ui/tests/integration/components/recipe-preview-test.js +++ b/ember-ui/tests/integration/components/meal-item-test.js @@ -4,31 +4,31 @@ import { setupMirage } from 'ember-cli-mirage/test-support'; import { render } from '@ember/test-helpers'; import { hbs } from 'ember-cli-htmlbars'; -module('Integration | Component | recipe-preview', function(hooks) { +module('Integration | Component | meal-preview', function(hooks) { setupRenderingTest(hooks); setupMirage(hooks); hooks.beforeEach(initMeal); test('it renders a wrapper href', async function(assert) { - await render(hbs``); + await render(hbs``); - assert.dom('[data-test-id=recipe-link]').hasTagName('a'); + assert.dom('[data-test-id=meal-link]').hasTagName('a'); }); - test('it renders recipe preview image', async function(assert) { - await render(hbs``); + test('it renders meal preview image', async function(assert) { + await render(hbs``); - assert.dom('[data-test-id=recipe-preview-image]').hasAttribute('src', 'image.jpg'); + assert.dom('[data-test-id=meal-preview-image]').hasAttribute('src', 'image.jpg'); }); - test('it renders recipe data as text', async function(assert) { - await render(hbs``); + test('it renders meal data as text', async function(assert) { + await render(hbs``); - assert.dom('[data-test-id=recipe-name]').hasText('Cookies'); - assert.dom('[data-test-id=recipe-ingredients-list]').hasText('Love, Chocolate'); - assert.dom('[data-test-id=recipe-tags]').includesText('Home'); - assert.dom('[data-test-id=recipe-tags]').includesText('Desserts'); + assert.dom('[data-test-id=meal-name]').hasText('Cookies'); + assert.dom('[data-test-id=meal-ingredients-list]').hasText('Love, Chocolate'); + assert.dom('[data-test-id=meal-tags]').includesText('Home'); + assert.dom('[data-test-id=meal-tags]').includesText('Desserts'); }); async function initMeal() { diff --git a/ember-ui/tests/integration/components/recipe-list-test.js b/ember-ui/tests/integration/components/meal-list-test.js similarity index 65% rename from ember-ui/tests/integration/components/recipe-list-test.js rename to ember-ui/tests/integration/components/meal-list-test.js index f77ab5e..ab98ade 100644 --- a/ember-ui/tests/integration/components/recipe-list-test.js +++ b/ember-ui/tests/integration/components/meal-list-test.js @@ -5,20 +5,20 @@ import { render, find, findAll, focus, triggerKeyEvent } from '@ember/test-helpe import { drag } from 'ember-sortable/test-support/helpers'; import { hbs } from 'ember-cli-htmlbars'; -module('Integration | Component | recipe-list', function(hooks) { +module('Integration | Component | meal-list', function(hooks) { setupRenderingTest(hooks); setupMirage(hooks); hooks.beforeEach(initMeals); test('it renders existing meals into a list', async function(assert) { - await render(hbs``); + await render(hbs``); - assert.dom('[data-test-id=recipe-item]').exists({ count: 2 }); + assert.dom('[data-test-id=meal-item]').exists({ count: 2 }); }); test('it can focus meal wrappers', async function(assert) { - await render(hbs``); + await render(hbs``); await focus('[data-sortable-handle]'); @@ -26,30 +26,30 @@ module('Integration | Component | recipe-list', function(hooks) { }); test('it can reorder meals via keyboard shortcuts', async function(assert) { - await render(hbs``); + await render(hbs``); - assert.dom(findAll('[data-test-id=recipe-name]')[0]).includesText('Meal 1'); - assert.dom(findAll('[data-test-id=recipe-name]')[1]).includesText('Meal 2'); + assert.dom(findAll('[data-test-id=meal-name]')[0]).includesText('Meal 1'); + assert.dom(findAll('[data-test-id=meal-name]')[1]).includesText('Meal 2'); await focus('[data-sortable-handle]'); // Not technically required, but emulates user interaction await triggerKeyEvent('[data-sortable-handle]', 'keydown', 'Enter'); await triggerKeyEvent('[data-sortable-handle]', 'keydown', 'ArrowDown'); await triggerKeyEvent('[data-sortable-handle]', 'keydown', 'Enter'); - assert.dom(findAll('[data-test-id=recipe-name]')[0]).includesText('Meal 2'); - assert.dom(findAll('[data-test-id=recipe-name]')[1]).includesText('Meal 1'); + assert.dom(findAll('[data-test-id=meal-name]')[0]).includesText('Meal 2'); + assert.dom(findAll('[data-test-id=meal-name]')[1]).includesText('Meal 1'); }); test('it can drag and drop meals', async function(assert) { - await render(hbs``); + await render(hbs``); - assert.dom(findAll('[data-test-id=recipe-name]')[0]).includesText('Meal 1'); - assert.dom(findAll('[data-test-id=recipe-name]')[1]).includesText('Meal 2'); + assert.dom(findAll('[data-test-id=meal-name]')[0]).includesText('Meal 1'); + assert.dom(findAll('[data-test-id=meal-name]')[1]).includesText('Meal 2'); await drag('mouse', '[data-sortable-handle]', () => { return { dy: 100, dx: 0 } }); - assert.dom(findAll('[data-test-id=recipe-name]')[0]).includesText('Meal 2'); - assert.dom(findAll('[data-test-id=recipe-name]')[1]).includesText('Meal 1'); + assert.dom(findAll('[data-test-id=meal-name]')[0]).includesText('Meal 2'); + assert.dom(findAll('[data-test-id=meal-name]')[1]).includesText('Meal 1'); }); async function initMeals() {