-
Notifications
You must be signed in to change notification settings - Fork 78
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add test and page component for select-inline-dropdown/list-item
- Loading branch information
Showing
2 changed files
with
67 additions
and
6 deletions.
There are no files selected for viewing
51 changes: 45 additions & 6 deletions
51
tests/integration/components/select-inline-dropdown/list-item-test.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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
22
tests/pages/components/select-inline-dropdown/list-item.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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' | ||
} | ||
} | ||
}; |