Translate EuiTabs to TS#2717
Translate EuiTabs to TS#2717chandlerprall merged 11 commits intoelastic:masterfrom junlarsen:euitabs-ts
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.
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
EuiTabbedContentPropsandEuiTabbedContentTabDescriptorin the export (so they can be re-used by other projects)
src/components/tabs/index.ts
- Export
EuiTabsPropsfrom'./tabs' - Export
EuiTabbedContentPropsfrom'./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.
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 |
chandlerprall
left a comment
There was a problem hiding this comment.
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
EuiTabsto TypeScriptChecklist