Skip to content

Commit

Permalink
Fixes #739 with project-header page object
Browse files Browse the repository at this point in the history
  • Loading branch information
joshsmith committed Feb 26, 2017
1 parent 38edb65 commit 8523ade
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 8 deletions.
1 change: 0 additions & 1 deletion app/templates/components/project-details.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
</div>

<div class="project__header__details">

<h2 class="project__header__title">
{{#link-to 'project.index' project}}
{{project.title}}
Expand Down
2 changes: 0 additions & 2 deletions app/templates/components/project-header.hbs
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
{{! is this template used at all? }}

<img class="icon" src={{project.iconThumbUrl}} alt={{project.title}} />
<h2>
{{project.title}}
Expand Down
20 changes: 15 additions & 5 deletions tests/integration/components/project-header-test.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,18 @@
import { moduleForComponent, test } from 'ember-qunit';
import hbs from 'htmlbars-inline-precompile';
import PageObject from 'ember-cli-page-object';
import component from 'code-corps-ember/tests/pages/components/project-header';

let page = PageObject.create(component);

moduleForComponent('project-header', 'Integration | Component | project header', {
integration: true
integration: true,
beforeEach() {
page.setContext(this);
},
afterEach() {
page.removeContext();
}
});

test('it displays the right title, icon, description', function(assert) {
Expand All @@ -15,9 +25,9 @@ test('it displays the right title, icon, description', function(assert) {
};
this.set('project', project);

this.render(hbs`{{project-header project=project}}`);
page.render(hbs`{{project-header project=project}}`);

assert.equal(this.$('img.icon').attr('src'), project.iconThumbUrl, 'Icon is rendered');
assert.equal(this.$('h2').text().trim(), project.title, 'Title is rendered');
assert.equal(this.$('p').text().trim(), project.description, 'Description is rendered');
assert.equal(page.icon.src, project.iconThumbUrl, 'Icon is rendered');
assert.equal(page.title.text, project.title, 'Title is rendered');
assert.equal(page.description.text, project.description, 'Description is rendered');
});
21 changes: 21 additions & 0 deletions tests/pages/components/project-header.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import {
attribute,
text
} from 'ember-cli-page-object';

export default {
description: {
scope: 'p',
text: text()
},

icon: {
scope: 'img.icon',
src: attribute('src')
},

title: {
scope: 'h2',
text: text()
}
};

0 comments on commit 8523ade

Please sign in to comment.