Skip to content

Commit 670a364

Browse files
committed
test: add test for createEvent type
1 parent 46644e2 commit 670a364

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

types/__tests__/type-tests.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import {
2+
createEvent,
23
fireEvent,
34
isInaccessible,
45
queries,
@@ -144,6 +145,10 @@ function eventTest() {
144145
throw new Error(`Can't find firstChild`)
145146
}
146147
fireEvent.click(element.firstChild)
148+
149+
// Custom event
150+
const customEvent = createEvent('customEvent', element)
151+
fireEvent(element, customEvent)
147152
}
148153

149154
async function testWaitFors() {

types/events.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ export type FireObject = {
9494
) => boolean
9595
}
9696
export type CreateFunction = (
97-
eventName: EventType,
97+
eventName: string,
9898
node: Document | Element | Window | Node,
9999
init?: {},
100100
options?: {EventType?: string; defaultInit?: {}},

0 commit comments

Comments
 (0)