I am trying to find to get jest to tab event to the next element but document.dispatchEvent doesn't seem to be working. I'm curious as to rather or not if the code i'm running is correct?
import { logger } from "@js-ecom-mfe/logger";
...
jest.mock("@js-ecom-mfe/logger");
describe("tests keyboard focus constrain", () => {
it("tab press", async() => {
// this is the keyboardtabevent
const tabEvent = new KeyboardEvent( 'keydown', { keyCode: 9,bubbles: true} )
// this is how i'm trying to fire the tab event
document.dispatchEvent(tabEvent)
})
})