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

refactor(batch-selection): ts conversion - FE-4767 #5654

Merged
merged 4 commits into from
Jan 9, 2023

Conversation

mkrds
Copy link
Contributor

@mkrds mkrds commented Nov 29, 2022

Proposed behaviour

This PR contains BatchSelection component TS conversion

Checklist

  • Commits follow our style guide
  • Related issues linked in commit messages if required
  • Screenshots are included in the PR if useful
  • All themes are supported if required
  • Unit tests added or updated if required
  • Cypress automation tests added or updated if required
  • Storybook added or updated if required
  • Translations added or updated (including creating or amending translation keys table in storybook) if required
  • Typescript d.ts file added or updated if required

QA

  • Tested in CodeSandbox/storybook
  • Add new Cypress test coverage if required
  • Carbon implementation matches Design System/designs
  • UI Tests GitHub check reviewed if required

Additional context

Testing instructions

Full regression testing of BatchSelection is recommended

@codesandbox-ci
Copy link

codesandbox-ci bot commented Nov 29, 2022

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

Latest deployment of this branch, based on commit 4d9ea4f:

Sandbox Source
carbon-quickstart Configuration
carbon-quickstart-typescript Configuration

@cypress
Copy link

cypress bot commented Nov 29, 2022



Test summary

4043 0 9 0Flakiness 0


Run details

Project carbon
Status Passed
Commit 4d9ea4f
Started Jan 9, 2023 2:06 PM
Ended Jan 9, 2023 2:13 PM
Duration 06:53 💡
OS Linux Debian - 11.4
Browser Chrome 106

View run in Cypress Dashboard ➡️


This comment has been generated by cypress-bot as a result of this project's GitHub integration settings. You can manage this integration in this project's settings in the Cypress Dashboard

@robinzigmond robinzigmond self-requested a review November 30, 2022 16:40
robinzigmond
robinzigmond previously approved these changes Nov 30, 2022
function renderBatchSelection(
props: Omit<BatchSelectionProps, "children">,
// eslint-disable-next-line @typescript-eslint/no-explicit-any
renderer: any = mount
Copy link
Contributor

Choose a reason for hiding this comment

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

annoying that you have to find this any, but I can't find another good solution either. I guess we can live with it in a test suite (especially as we're going to move away from Enzyme anyway!). (Even typeof mount | typeof shallow doesn't work - TS seems to think you can't call that!)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yep, I spent some time trying to figure it out but then decided that it's not really worth it considering it's a spec file and as you said we'll be getting rid of enzyme anyawy

Copy link
Contributor

Choose a reason for hiding this comment

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

one solution is to just remove the snapshot and not use shallow at all (we already have Chromatic for that). It will be removed anyway with our conversion to RTL.

src/components/batch-selection/batch-selection.stories.tsx Outdated Show resolved Hide resolved
Comment on lines 46 to 50
export const Light = Themed.bind({});
Light.args = {
selectedCount: 2,
colorTheme: "light",
};
Copy link
Contributor

@Parsium Parsium Dec 12, 2022

Choose a reason for hiding this comment

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

I'm not sure why, but some of the onAction props in this example are being rendered as noRefCheck() which may be confusing. It seems modifying the story to not use args fixes the issue? I'm not sure why the first IconButton's onAction prop is being displayed correctly though.

Screenshot 2022-12-12 at 15 31 15

This seems to be the case with the other stories using the Template.bind({}) pattern as well.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That's weird I found an issue in Storybook github repo related to this - storybookjs/storybook#17701

It seems that it has already been fixed, but will be released in v7
storybookjs/storybook#19004

Copy link
Contributor

Choose a reason for hiding this comment

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

Thanks for sharing this @mkrds 👍🏼 Its good to know this has been addressed by the storybook team.

As the release date for Storybook 7.0 doesn't seem to have been announced yet - what do you think about modifying the stories to not use the Template.bind() pattern in the meantime?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sure thing @Parsium, fixed :)

@mkrds mkrds force-pushed the FE-4767-batch-selection-ts-conversion branch 3 times, most recently from 172a40e to 371ebf1 Compare December 19, 2022 12:52
robinzigmond
robinzigmond previously approved these changes Dec 19, 2022
@mkrds mkrds force-pushed the FE-4767-batch-selection-ts-conversion branch from 78dd6bc to e534e43 Compare December 23, 2022 17:11
grabkowski
grabkowski previously approved these changes Jan 2, 2023
robinzigmond
robinzigmond previously approved these changes Jan 3, 2023
@mkrds mkrds marked this pull request as ready for review January 4, 2023 15:44
@mkrds mkrds requested review from a team as code owners January 4, 2023 15:44
ZhuoyuJin
ZhuoyuJin previously approved these changes Jan 9, 2023
@mkrds mkrds dismissed stale reviews from ZhuoyuJin, robinzigmond, and grabkowski via 00d4374 January 9, 2023 13:46
@mkrds mkrds merged commit 5569e6b into master Jan 9, 2023
@mkrds mkrds deleted the FE-4767-batch-selection-ts-conversion branch January 9, 2023 14:16
@carbonci
Copy link
Collaborator

carbonci commented Jan 9, 2023

🎉 This PR is included in version 112.0.1 🎉

The release is available on:

Your semantic-release bot 📦🚀

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

Successfully merging this pull request may close these issues.

6 participants