Skip to content
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

Implement Polaris inline-error component #174

Merged
merged 7 commits into from
Oct 5, 2018
Merged

Conversation

vladucu
Copy link
Member

@vladucu vladucu commented Oct 4, 2018

fix #175

@vladucu vladucu self-assigned this Oct 4, 2018
@vladucu vladucu force-pushed the feature/polaris-inline-error branch from 12d43b9 to da1b4bb Compare October 4, 2018 11:48
@vladucu vladucu changed the title Implement Polaris inline-error component [WIP] Implement Polaris inline-error component Oct 4, 2018
@vladucu vladucu changed the title [WIP] Implement Polaris inline-error component Implement Polaris inline-error component Oct 4, 2018

init() {
this._super(...arguments);
assert('[polaris-inline-error] Missing required `fieldID` param!', this.get('fieldID'));
Copy link
Contributor

Choose a reason for hiding this comment

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

can we start using this.fieldID instead of this.get?

Copy link
Member Author

Choose a reason for hiding this comment

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

was bitten by this the other day...it won't work in apps on pre-ember 3.1
is there any way to support older versions of Ember too in the addon?

<div
class="Polaris-InlineError"
id={{concat fieldID "Error"}}
data-test-inline-error={{data-test-inline-error}}
Copy link
Contributor

Choose a reason for hiding this comment

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

If we had it as,

 <div
    data-test-inline-error
    class="Polaris-InlineError"
    id={{concat fieldID "Error"}}
></div>

then we wouldn't need to set the same on the class as boolean flags. You could find the usage here.

Copy link
Member Author

Choose a reason for hiding this comment

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

yes, but in a consuming app, in an acceptance test where you have multiple instances....would complicate testing no?

Copy link
Member Author

Choose a reason for hiding this comment

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

so you could do for example:

...
{{polaris-inline-error data-test-inline-error="email-error"}}
{{polaris-inline-error data-test-inline-error="password-error"}}

and just directly use these selectors in tests....

Copy link
Contributor

Choose a reason for hiding this comment

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

ah got it 🙂👍🏻. May be we could add a note in our readme doc somewhere under the testing section about this

Copy link
Member Author

Choose a reason for hiding this comment

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

agreed...will add

Copy link
Member

@andrewpye andrewpye left a comment

Choose a reason for hiding this comment

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

Looks good! Can you add a documentation file for the component though please?


init() {
this._super(...arguments);
assert('[polaris-inline-error] Missing required `fieldID` param!', this.get('fieldID'));
Copy link
Member

Choose a reason for hiding this comment

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

The React component doesn't seem to care about this... why do we?

Copy link
Member Author

Choose a reason for hiding this comment

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

the docs mention it's required...I'm fine with dropping this, tbh

Copy link
Member

Choose a reason for hiding this comment

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

True... don't see anything in the code enforcing it but maybe there's something in React that requires the props to be present 🤷‍♂️

Copy link
Member Author

Choose a reason for hiding this comment

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

TypeScript

}}
`);

assert.dom('[data-test-inline-error]').exists();
Copy link
Member

Choose a reason for hiding this comment

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

These test selectors are pretty neat 😄

@vladucu vladucu merged commit bacd0e2 into dev Oct 5, 2018
@delete-merged-branch delete-merged-branch bot deleted the feature/polaris-inline-error branch October 5, 2018 10:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants