Skip to content

added country dropdown - #878

Merged
joshsmith merged 1 commit into
developfrom
864-update-country-dropdown
Dec 17, 2016
Merged

added country dropdown#878
joshsmith merged 1 commit into
developfrom
864-update-country-dropdown

Conversation

@rileytaylor

Copy link
Copy Markdown
Contributor

What's in this PR?

This enables the country dropdown and makes it a proper select dropdown. The only option, for now, is 'US'

References

Fixes #864

Progress on: #853

@rileytaylor

Copy link
Copy Markdown
Contributor Author

I'm going to redo this using the x-select component, display the country as a full name in the select ui. and I also need to add tests.

@joshsmith

Copy link
Copy Markdown
Contributor

@rileytaylor you can look to my other open PR for ideas on how to test with selectable.

});

test('it sets the country strings correctly', function(assert) {

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.

Think you can use the existing tests in the select/birth-date


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 = this.get('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.


page.country.fillIn('US');

let country = this.get('country');

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.

Prefer get(this, 'prop') and set(this, 'prop'). const { get, set } = Ember;

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.

Should birth-date also use this? I agree this is better I just didn't do it initially since i didn't see any other tests using it

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.

Yeah, it should.

Comment thread app/components/select/country-select.js Outdated
export default Component.extend({
classNames: ['select-country'],
countryOptions: [
{ name:'United States', abbr:'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.

Would change abbr to id. Also would space after each :

Comment thread app/components/select/country-select.js Outdated

const {
Component
} = Ember;

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.

Extra space before }.

@@ -0,0 +1,10 @@
<label>
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.

I would actually out the label outside so that can be user-defined. Don't need a wrapping div around the select either.

{{input type="text" name="zip" value=zip}}
</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.

@joshsmith
joshsmith merged commit 567944a into develop Dec 17, 2016
@joshsmith
joshsmith deleted the 864-update-country-dropdown branch December 17, 2016 06:06
@joshsmith

Copy link
Copy Markdown
Contributor

🙌

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants