Skip to content

Commit

Permalink
Add test and page component for select-inline-dropdown/list-item
Browse files Browse the repository at this point in the history
  • Loading branch information
begedin authored and joshsmith committed Feb 20, 2017
1 parent b5017eb commit f270c64
Show file tree
Hide file tree
Showing 2 changed files with 67 additions and 6 deletions.
Original file line number Diff line number Diff line change
@@ -1,12 +1,51 @@
import { moduleForComponent, test } from 'ember-qunit';
import hbs from 'htmlbars-inline-precompile';
import pageComponent from 'code-corps-ember/tests/pages/components/select-inline-dropdown/list-item';
import PageObject from 'ember-cli-page-object';
import Ember from 'ember';

moduleForComponent('select-inline-dropdown/list-item', 'Integration | Component | select inline dropdown/list item', {
integration: true
});
const { setProperties } = Ember;

let page = PageObject.create(pageComponent);

moduleForComponent(
'select-inline-dropdown/list-item',
'Integration | Component | select inline dropdown/list item', {
integration: true,
beforeEach() {
page.setContext(this);
},
afterEach() {
page.removeContext();
}
}
);

function renderPage() {
page.render(hbs`
{{select-inline-dropdown/list-item
iconUrl=iconUrl
primaryText=primaryText
secondaryText=secondaryText
lastSearchedText=lastSearchedText
}}`);
}

test('it renders correctly', function(assert) {
assert.expect(5);

let iconUrl = 'testurl';
let primaryText = 'Test';
let secondaryText = 'testuser';
let lastSearchedText = 'est';

setProperties(this, { iconUrl, primaryText, secondaryText, lastSearchedText });

test('it renders', function(assert) {
this.render(hbs`{{select-inline-dropdown/list-item}}`);
renderPage();

assert.equal(this.$().text().trim(), '');
assert.equal(page.icon.url, iconUrl, 'Icon is rendered.');
assert.equal(page.primary.text, primaryText, 'Primary text is rendered.');
assert.equal(page.primary.highlighted.text, lastSearchedText, 'Filtered text is rendered on primary.');
assert.equal(page.secondary.text, secondaryText, 'Secondary text is rendered.');
assert.equal(page.secondary.highlighted.text, lastSearchedText, 'Filtered text is rendered on secondary.');
});
22 changes: 22 additions & 0 deletions tests/pages/components/select-inline-dropdown/list-item.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import { attribute } from 'ember-cli-page-object';

export default {
icon: {
scope: '.select-inline-dropdown__list-item__icon',
url: attribute('src', 'img')
},

primary: {
scope: '.select-inline-dropdown__list-item__content__primary',
highlighted: {
scope: 'strong'
}
},

secondary: {
scope: '.select-inline-dropdown__list-item__content__secondary',
highlighted: {
scope: 'strong'
}
}
};

0 comments on commit f270c64

Please sign in to comment.