You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[Focus] Accessibility (a11y)Changes that impact accessibility and need corresponding review (e.g. markup changes).[Type] BugAn existing feature does not function as intended
Not saying this is necessarily the best option, but being able to get a ref to IconButton would be nice. Worth reminding refs help in managing focus when necessary, so they are important for accessibility.
Since that time, Enzyme has updated to provide more up-to-date adapters. Updating those may resolve some issue there to test the component. It's been on my task list to take a look at this.
In parallel, it might make sense to push up what you have (even failing) as a pull request, and collaborate on resolving the test failures.
Since that time, Enzyme has updated to provide more up-to-date adapters. Updating those may resolve some issue there to test the component. It's been on my task list to take a look at this.
Yep, spent some (too much) time on this and then saw the button mock, researched what the real problem was, and finally found the Enzyme issue with forwardRef. Some of the tests can be worked around, but I guess the IconButton tests will need the updated Enzyme stuff. Will push what I have, thanks!
[Focus] Accessibility (a11y)Changes that impact accessibility and need corresponding review (e.g. markup changes).[Type] BugAn existing feature does not function as intended
Activity
afercia commentedon Feb 27, 2019
Played a bit with this:
forwardRefapproach works but then fixing the tests is a bit challenging (at least for me) as some of them depends on the component's nameinnerRefprop passed down toButtonwould work?Seems to me the first approach is preferable but this issue needs someone with expertise in building tests 🙂
aduth commentedon Feb 27, 2019
I'd agree with this.
Looking at the following, I think there was some hacking done to make Button and its
forwardRefusage play nicely with tests / Enzyme:https://github.com/WordPress/gutenberg/blob/master/packages/components/src/button/__mocks__/index.js
Since that time, Enzyme has updated to provide more up-to-date adapters. Updating those may resolve some issue there to test the component. It's been on my task list to take a look at this.
In parallel, it might make sense to push up what you have (even failing) as a pull request, and collaborate on resolving the test failures.
aduth commentedon Feb 27, 2019
See: #11214, #14156
afercia commentedon Feb 27, 2019
Yep, spent some (too much) time on this and then saw the button mock, researched what the real problem was, and finally found the Enzyme issue with
forwardRef. Some of the tests can be worked around, but I guess the IconButton tests will need the updated Enzyme stuff. Will push what I have, thanks!