The dispatchEvent function is added as a test utility
The dispatchEvent function is intended to facilitate component testing, allowing you to dispatch events from an event and customize its target, example:
import { fixture, asyncEventListener, dispatchEvent } from "atomico/test-dom";
test("check target", async () => {
const myComponent = fixture(<MyComponent />);
const eventName = "myEvent";
queueMicrotask(() => {
const target = { value: 1000 };
const event = new Event(eventName);
dispatchEvent(myComponent, event, target);
});
const event = await asyncEventListener(myComponent, eventName);
expect(event.target).toEqual({ value: 1000 });
});