Skip to content
Browse files

Specify detail component should display model fields

We add a component test that reproduces the acceptance test error: we specify that the component displays the post's title. And we go ahead and specify that it displays the body, too, because that seems safe in this case.

Inner red:
✘ Element .js-post-detail-title exists
✘ Element .js-post-detail-body exists

This means that the title field was not found, to be able to retrieve the textContent from it.
  • Loading branch information...
CodingItWrong committed Jan 11, 2018
1 parent 3600360 commit e29dcb230bbc4d843befcffd0fb26d37cf8f4bb6
Showing with 8 additions and 14 deletions.
  1. +8 −14 tests/integration/components/post-detail-test.js
@@ -6,21 +6,15 @@ import hbs from 'htmlbars-inline-precompile';
module('Integration | Component | post-detail', function(hooks) {

test('it renders', async function(assert) {
// Set any properties with this.set('myProperty', 'value');
// Handle any actions with this.set('myAction', function(val) { ... });
test('it displays details for the passed-in post', async function(assert) {
this.set('testModel', {
title: 'Test Title',
body: 'This is a test post!',

await render(hbs`{{post-detail}}`);
await render(hbs`{{post-detail post=testModel}}`);

assert.equal(this.element.textContent.trim(), '');

// Template block usage:
await render(hbs`
template block text

assert.equal(this.element.textContent.trim(), 'template block text');
assert.dom('.js-post-detail-title').hasText('Test Title');
assert.dom('.js-post-detail-body').hasText('This is a test post!');

0 comments on commit e29dcb2

Please sign in to comment.
You can’t perform that action at this time.