Verifying components relying on tabster through unit tests
sjwilczynski opened this issue · comments
Hey folks,
I am using Fluent 9 Popover and wanted to verify that correct element is focused open opening the Popover. For the component I created, I can visually verify in Storybook that correct element is focused. However, when I want to make such assertion in unit tests, it seems to no longer be the case. Can tabster functionality be somehow verified in jest
and jsdom
environment? Or the only way to verify is to have e2e tests, rendering browser window?
Unfortunately the browser is the only way to assert what happens with focus correctly in general, we've generally tried to avoid asserting anything focus related in JSDOM. Tabster and other focus utilities have a habit of doing things asynchronously with timeouts in some cases, so it's not an easy proposition to test focus there