Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion app/components/payments/funds-recipient.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ export default Component.extend({
set(this, 'dobDay', 1);
set(this, 'dobMonth', 1);
set(this, 'dobYear', 2016);
set(this, 'country', 'US');
this._super(...arguments);
},

Expand All @@ -33,7 +34,6 @@ export default Component.extend({
'dobDay', 'dobMonth', 'dobYear',
'address1', 'address2', 'city', 'state', 'country', 'zip'
);

this.sendAction('recipientInformationSubmitted', fundsRecipient);
}
}
Expand Down
12 changes: 12 additions & 0 deletions app/components/select/country-select.js
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' }
]
});
4 changes: 1 addition & 3 deletions app/templates/components/payments/funds-recipient.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,7 @@
</div>
<div class="input-group">
<label for="country">Country</label>

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would add this label back.

<select value=country name="country">
<option value="US">United States</option>
</select>
{{select/country-select country=country}}
</div>
</div>
<div class="input-group">
Expand Down
5 changes: 5 additions & 0 deletions app/templates/components/select/country-select.hbs
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}}
31 changes: 31 additions & 0 deletions tests/integration/components/select/country-select-test.js
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');

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you only fillIn with the value and not the full name.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure what you mean by this, isn't US is the value?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The 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.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The 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');

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would definitely condense all of these down without gaps between lines.

});
12 changes: 12 additions & 0 deletions tests/pages/components/select/country-select.js
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()
}
};