-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
Add storybook story for Disabled component #20514
Conversation
Size Change: 0 B Total Size: 856 kB ℹ️ View Unchanged
|
As discussed on Slack yesterday, we will need to upgrade Jest to use the latest version of JSDom which supports |
I updated jest, jsdom and storybook to the most recent versions locally and am still getting this error without the setup/teardown methods: `● Storyshots › Components/Disabled › Default
The js configuration for Gutenberg is a bit more complex than I am used to working with, so it's possible I am not updating what I think I am or in the correct place. |
I opened #20766 which tries to upgrade Jest and JSDom to the more recent versions. |
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.
It all looks great. I left two comments to respond. We should document the issue with MutationObserver
and file a follow-up issue to unblock this PR.
|
||
export const _default = () => { | ||
return ( | ||
<Disabled> |
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.
Do we need all those components to include in here? Can we use the most representative 3? I don't have answers, I'm thinking whether it's enough to cover those that use input
, select
and textarea
.
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.
I questioned that too, and nearly added just a single input
. I would be fine with making it just the top three, maybe @ItsJonQ might have an opinion?
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.
Hai! 👋
I think max 3 would be okay. Let's go with that 👍
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.
Updated 🙂
76c27f1
to
52571a4
Compare
…onObserver, which the Disabled component needs
52571a4
to
0e8b251
Compare
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.
🚀 Tested and looks good to me! Thank you @brentswisher !
Will merge once Travis is 💚 ! |
* refactor storybook * convert to typescript * fix ComponentProps * add changelog. * fix imports order * use WordPressComponentProps. * add example * Update packages/components/src/disabled/types.ts Co-authored-by: Marco Ciampini <marco.ciampo@gmail.com> * Update packages/components/src/disabled/index.tsx Co-authored-by: Marco Ciampini <marco.ciampo@gmail.com> * Update packages/components/src/disabled/index.tsx Co-authored-by: Petter Walbø Johnsgård <petter@dekode.no> * Update packages/components/src/disabled/index.tsx Co-authored-by: Petter Walbø Johnsgård <petter@dekode.no> * Remove unused imports. * Rewrite to Testing-library `will disable all fields` * Rewrite to Testing-library `should cleanly un-disable via reconciliation` * use rerender * refactor test. * replace react-dom/test-utils to testing-library. * remove unnecessary MutationObserver stab. @see #20766 #20514 * Convert to typescript. * add story for contentEditable * add control settings. * fix changelog * Update packages/components/CHANGELOG.md Co-authored-by: Marco Ciampini <marco.ciampo@gmail.com> * Omit ref. * avoid querying * rename div. * test before rerender * Simplify * Update packages/components/src/disabled/test/index.tsx Co-authored-by: Marco Ciampini <marco.ciampo@gmail.com> * test for sneaky DOM manipulation * Fix `isDisabled` so that it keeps its value even if it is changed. * add default args * Revert "Fix `isDisabled` so that it keeps its value even if it is changed." This reverts commit 28820f0. * Update packages/components/src/disabled/test/index.tsx * Update packages/components/CHANGELOG.md Co-authored-by: Marco Ciampini <marco.ciampo@gmail.com> Co-authored-by: Petter Walbø Johnsgård <petter@dekode.no>
Description
Adds a storybook story for the Disabled component as part of #17973
I had to make a decision on this story regarding what/how much to put in the component to show as disabled. I included all the "basic" form controls as well as a few of the more complex ones. I don't have a strong feeling on what should be shown, so if anyone has feedback on more/less child components just let me know.
Concerns
I also ran into a few things with the storyshot integration I want to call out:
I am pretty sure this is intentional but didn't see it documented everywhere so I just wanted to double-check.
How has this been tested?
npm run storybook:dev
Screenshots
Types of changes
New feature (non-breaking change which adds functionality)
Checklist: