-
-
Notifications
You must be signed in to change notification settings - Fork 31.7k
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
[Accordion] Fix IconButtonProps spreading logic #21850
[Accordion] Fix IconButtonProps spreading logic #21850
Conversation
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.
Actual fix looks good. One minor regarding unrelated changes.
packages/material-ui/src/AccordionSummary/AccordionSummary.test.js
Outdated
Show resolved
Hide resolved
@@ -99,6 +111,17 @@ describe('<AccordionSummary />', () => { | |||
expect(button).not.to.have.class(classes.focused); | |||
}); | |||
|
|||
it('should fire onBlur when the button blurs', () => { |
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.
That one requires act
.
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 don't understand why it's green in my env
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.
Ohhh, it's because I'm running the tests in watch mode! I still haven't got used to mochajs/mocha#4347.
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 passes, but I think the idea is that we're asserting on the result of the field receiving focus and blurring and we want to ensure that the updates are completed prior to assertion.
There are a few other places in the codebase that are inconsistent about this, so I didn't wrap it here (e.g. Select.test.js
, , but I probably should have. Sorry about that.
@eps1lon what is the difference between this (in blur should unset unfocused state
):
act(() => {
button.focus();
});
act(() => {
button.blur();
});
...and wrapping them with one act
? Is it that we're allowing focus
to update before we blur
?
…ops are provided Ensure that `expanded` and `IconButtonProps.className` are applied. Added `onBlur` test to improve coverage of this component.
@kgregory Thanks, it's great to not only fix the bug in question but to actually be a good boy-scout, leaving the place in better shape than when entering. |
@oliviertassinari thanks. Sorry about missing that |
@kgregory I think that it's simply because your fork next branch is from an old version (~20 days), your build was green before I rebased it. Try pulling the latest changes :) |
@oliviertassinari oh that's embarrassing. Will do. |
The
expanded
class was being replaced whenIconButtonProps
was provided with aclassName
. To fix this, we revisit the application ofclassName
toIconButton
. We will continue to conditionally applyexpanded
, but now we'll combine it withclassName
fromIconButtonProps
, which now defaults to an empty object.Added
onBlur
test to improve coverage of this component.Regenerated docs.
Closes #21744