-
Notifications
You must be signed in to change notification settings - Fork 843
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
Translate EuiTabs to TS #2717
Translate EuiTabs to TS #2717
Conversation
Since this is a community submitted pull request, a Jenkins build has not been kicked off automatically. Can an Elastic organization member please verify the contents of this patch and then kick off a build manually? |
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.
Thank you for this PR!
A few requests, mostly around the TypeScript patterns we've established in EUI. In addition to the comments in this review:
src/components/tabs/tabbed_content/index.ts
- Include
EuiTabbedContentProps
andEuiTabbedContentTabDescriptor
in the export (so they can be re-used by other projects)
src/components/tabs/index.ts
- Export
EuiTabsProps
from'./tabs'
- Export
EuiTabbedContentProps
from'./tabbed_content'
src/components/tabs/index.d.ts
- Delete this file
src/components/index.d.ts
- Remove
/// <reference path="./tabs/index.d.ts" />
When this PR is stable I'll also do a custom EUI build with these types to verify usages in Kibana.
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.
Couple more requests, then I'll drop these into Kibana for another round of testing.
Additionally, there's some eslint errors which can be automatically fixed by running yarn lint-es-fix
and committing the results.
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.
Built EUI and tested in Kibana, found these three things -
EuiTabbedContentTab export
(see inline comment associated with this review)
Snapshots
Two jest snapshots need to be updated, please run yarn test-unit -u
and commit the results.
Sinon
tabbed_content.test.tsx uses sinon
for one test, and we haven't installed @types/sinon
as we want to move away from that library and rely solely on Jest. Please remove the sinon
import and lines 39-47 should be changed to
test('is called when a tab is clicked', () => {
const onTabClickHandler = jest.fn();
const component = mount(
<EuiTabbedContent onTabClick={onTabClickHandler} tabs={tabs} />
);
findTestSubject(component, 'kibanaTab').simulate('click');
expect(onTabClickHandler).toBeCalledTimes(1);
expect(onTabClickHandler).toBeCalledWith(kibanaTab);
});
Thanks for these changes! Now waiting for two things (not on you) -
|
Quick update on both points:
|
@supergrecko Good news! We can accept your signing as is! You can access the Contributor License Agreement at https://www.elastic.co/contributor-agreement - please use the same email address as your github account so our automation can verify. I should have the babel package upgrade finished up in a couple days. Thank you very much for your patience with me on this. |
jenkins test this |
Two lint errors:
These are fixable with |
That's strange, did we change any eslint/prettier rules? Those two sets of parentheses were added during an earlier ESLint run (see 49895d0) When I run |
Hmm, that is odd. I went back to the Please go ahead and manually change those two lines. |
jenkins test this |
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.
Changes LGTM; Pulled and tested locally.
Thanks for the conversion, @supergrecko ! |
* Translate EuiTabs to TS * EuiTabs: Export Props types and insert temporary type for FocusEvent * EuiTabs: Remove defaultProps and use types derived from object * EuiTabs: remove propTypes from EuiTabs * EuiTabs: move PropTypes docblocks into Props types * EuiTabs: run ESLint * EuiTabs: update jest snapshots * EuiTabs: Revert name change and update exports * Add changelog entry * Manually remove parentheses added by Eslint
Summary
Closes #2645
Converted
EuiTabs
to TypeScriptChecklist