-
Notifications
You must be signed in to change notification settings - Fork 75
added country dropdown #878
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| import Ember from 'ember'; | ||
|
|
||
| const { | ||
| Component | ||
| } = Ember; | ||
|
|
||
| export default Component.extend({ | ||
| classNames: ['select-country'], | ||
| countryOptions: [ | ||
| { name: 'United States', id: 'US' } | ||
| ] | ||
| }); |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| {{#x-select value=country as |xs| }} | ||
| {{#each countryOptions as |countryOption|}} | ||
| {{#xs.option value=countryOption.id}}{{countryOption.name}}{{/xs.option}} | ||
| {{/each}} | ||
| {{/x-select}} |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,31 @@ | ||
| import { moduleForComponent, test } from 'ember-qunit'; | ||
| import Ember from 'ember'; | ||
| import hbs from 'htmlbars-inline-precompile'; | ||
| import selectCountry from '../../../pages/components/select/country-select'; | ||
| import PageObject from 'ember-cli-page-object'; | ||
|
|
||
| const { | ||
| get, | ||
| set | ||
| } = Ember; | ||
|
|
||
| let page = PageObject.create(selectCountry); | ||
|
|
||
| moduleForComponent('select/country-select', 'Integration | Component | select/country select', { | ||
| integration: true, | ||
| beforeEach() { | ||
| page.setContext(this); | ||
| }, | ||
| afterEach() { | ||
| page.setContext(this); | ||
| } | ||
| }); | ||
|
|
||
| test('it sets the correct country', function(assert) { | ||
| assert.expect(1); | ||
| set(this, 'country', 'US'); | ||
| page.render(hbs`{{select/country-select country=country}}`); | ||
| page.country.fillIn('US'); | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can you only
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm not sure what you mean by this, isn't
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm asking if we can pass "United States" instead, more out of curiosity.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Oh! So the select box says "United States" but the value passed around is US. |
||
| let country = get(this, 'country'); | ||
| assert.equal(country, 'US'); | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I would definitely condense all of these down without gaps between lines. |
||
| }); | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| import { | ||
| selectable | ||
| } from 'ember-cli-page-object'; | ||
|
|
||
| export default { | ||
| scope: '.select-country', | ||
|
|
||
| country: { | ||
| scope: 'select:eq(0)', | ||
| fillIn: selectable() | ||
| } | ||
| }; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would add this
labelback.