mirror of
https://github.com/coder/coder.git
synced 2026-09-24 15:04:27 +08:00
19 lines
451 B
TypeScript
19 lines
451 B
TypeScript
import { dispatchCustomEvent, isCustomEvent } from "./events";
|
|
|
|
describe("events", () => {
|
|
describe("dispatchCustomEvent", () => {
|
|
it("dispatch a custom event", (done) => {
|
|
const eventDetail = { title: "Event title" };
|
|
|
|
window.addEventListener("eventType", (event) => {
|
|
if (isCustomEvent(event)) {
|
|
expect(event.detail).toEqual(eventDetail);
|
|
done();
|
|
}
|
|
});
|
|
|
|
dispatchCustomEvent("eventType", eventDetail);
|
|
});
|
|
});
|
|
});
|