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
First of all, thank you so much for the great work on emoji-picker-react 🙏 .
I wanted to report that we saw our unit tests fail when upgrading to 4.9.2. We believe the breaking change was introduced as part of 4.9.1. More specifically in the getLabelHight function here
Since the DEFAULT_LABEL_HEIGHT is now returned whenever no height greater than 0 is found, the function will always return 40 when running inside JSDOM. All other measurements (getBoundingClientRect, getBoundingClientRect, ...), however will return 0. This makes it so that no emoji is found when calling focusFirstVisibleEmoji.
We have a test that does something along these lines:
const searchBox = screen.getByRole('textbox', { name: 'Type to search for an emoji' });
await userEvent.type(searchBox, 'cat');
await userEvent.tab();
await userEvent.tab();
await userEvent.tab();
await userEvent.keyboard('{enter}');
expect(update).toHaveBeenCalledWIth(...)
We've currently fixed this by mocking getBoundingClientRect and getBoundingClientRect to return values in way so that focusFirstVisibleEmoji does return results. However, this is not very transparant and might easily break if the underlying implementation changes.
Though this is an issue that will only occur when running in JSDOM, I think more folks might run into this, so if there's a way to change the implementation to accommodate this, that'd be really great!
Thanks again for you work.
Regards,
Jelle
The text was updated successfully, but these errors were encountered:
Hi 👋
First of all, thank you so much for the great work on emoji-picker-react 🙏 .
I wanted to report that we saw our unit tests fail when upgrading to 4.9.2. We believe the breaking change was introduced as part of 4.9.1. More specifically in the
getLabelHight
function hereSince the
DEFAULT_LABEL_HEIGHT
is now returned whenever no height greater than 0 is found, the function will always return 40 when running inside JSDOM. All other measurements (getBoundingClientRect, getBoundingClientRect, ...), however will return 0. This makes it so that no emoji is found when callingfocusFirstVisibleEmoji
.We have a test that does something along these lines:
We've currently fixed this by mocking
getBoundingClientRect
andgetBoundingClientRect
to return values in way so thatfocusFirstVisibleEmoji
does return results. However, this is not very transparant and might easily break if the underlying implementation changes.Though this is an issue that will only occur when running in JSDOM, I think more folks might run into this, so if there's a way to change the implementation to accommodate this, that'd be really great!
Thanks again for you work.
Regards,
Jelle
The text was updated successfully, but these errors were encountered: