All tests passing
This commit is contained in:
parent
726b65b7f3
commit
12305dff37
2 changed files with 15 additions and 13 deletions
|
@ -4,26 +4,33 @@ import { setupMirage } from 'ember-cli-mirage/test-support';
|
||||||
import { render } from '@ember/test-helpers';
|
import { render } from '@ember/test-helpers';
|
||||||
import { hbs } from 'ember-cli-htmlbars';
|
import { hbs } from 'ember-cli-htmlbars';
|
||||||
|
|
||||||
module('Integration | Component | meal-preview', function(hooks) {
|
module('Integration | Component | meal-item', function(hooks) {
|
||||||
setupRenderingTest(hooks);
|
setupRenderingTest(hooks);
|
||||||
setupMirage(hooks);
|
setupMirage(hooks);
|
||||||
|
|
||||||
hooks.beforeEach(initMeal);
|
hooks.beforeEach(initMeal);
|
||||||
|
|
||||||
|
const defaultTemplate = hbs`
|
||||||
|
<MealItem
|
||||||
|
@meal={{meal}}
|
||||||
|
@handleFocus={{handleFocus}}
|
||||||
|
@handleBlur={{handleBlur}} />
|
||||||
|
`;
|
||||||
|
|
||||||
test('it renders a wrapper href', async function(assert) {
|
test('it renders a wrapper href', async function(assert) {
|
||||||
await render(hbs`<MealItem @meal={{meal}} />`);
|
await render(defaultTemplate);
|
||||||
|
|
||||||
assert.dom('[data-test-id=meal-link]').hasTagName('a');
|
assert.dom('[data-test-id=meal-link]').hasTagName('a');
|
||||||
});
|
});
|
||||||
|
|
||||||
test('it renders meal preview image', async function(assert) {
|
test('it renders meal preview image', async function(assert) {
|
||||||
await render(hbs`<MealItem @meal={{meal}} />`);
|
await render(defaultTemplate);
|
||||||
|
|
||||||
assert.dom('[data-test-id=meal-preview-image]').hasAttribute('src', 'image.jpg');
|
assert.dom('[data-test-id=meal-preview-image]').hasAttribute('src', 'image.jpg');
|
||||||
});
|
});
|
||||||
|
|
||||||
test('it renders meal data as text', async function(assert) {
|
test('it renders meal data as text', async function(assert) {
|
||||||
await render(hbs`<MealItem @meal={{meal}} />`);
|
await render(defaultTemplate);
|
||||||
|
|
||||||
assert.dom('[data-test-id=meal-name]').hasText('Cookies');
|
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-ingredients-list]').hasText('Love, Chocolate');
|
||||||
|
@ -49,6 +56,8 @@ module('Integration | Component | meal-preview', function(hooks) {
|
||||||
name: 'Cookies',
|
name: 'Cookies',
|
||||||
thumbnailUrl: 'image.jpg',
|
thumbnailUrl: 'image.jpg',
|
||||||
});
|
});
|
||||||
this.set('meal', await store.findRecord('meal', 1));
|
this.meal = await store.findRecord('meal', 1);
|
||||||
|
this.handleFocus = () => {};
|
||||||
|
this.handleBlur = () => {};
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -6,14 +6,7 @@ import { hbs } from 'ember-cli-htmlbars';
|
||||||
module('Integration | Component | sortable-group-accessible', function(hooks) {
|
module('Integration | Component | sortable-group-accessible', function(hooks) {
|
||||||
setupRenderingTest(hooks);
|
setupRenderingTest(hooks);
|
||||||
|
|
||||||
test('it renders', async function(assert) {
|
test('it can yield text content', async function(assert) {
|
||||||
// Set any properties with this.set('myProperty', 'value');
|
|
||||||
// Handle any actions with this.set('myAction', function(val) { ... });
|
|
||||||
|
|
||||||
await render(hbs`<SortableGroupAccessible />`);
|
|
||||||
|
|
||||||
assert.equal(this.element.textContent.trim(), '');
|
|
||||||
|
|
||||||
// Template block usage:
|
// Template block usage:
|
||||||
await render(hbs`
|
await render(hbs`
|
||||||
<SortableGroupAccessible>
|
<SortableGroupAccessible>
|
||||||
|
|
Loading…
Add table
Reference in a new issue