mirror of
https://github.com/FlipsideCrypto/DefinitelyTyped.git
synced 2026-02-06 10:56:53 +00:00
Copied user-event definition to new testing-library organization (#36000)
This commit is contained in:
parent
695e81c90d
commit
4b88e01657
20
types/testing-library__user-event/index.d.ts
vendored
Normal file
20
types/testing-library__user-event/index.d.ts
vendored
Normal file
@ -0,0 +1,20 @@
|
||||
// Type definitions for @testing-library/user-event 4.0
|
||||
// Project: https://github.com/testing-library/user-event
|
||||
// Definitions by: Wu Haotian <https://github.com/whtsky>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
export interface UserOpts {
|
||||
allAtOnce?: boolean;
|
||||
delay?: number;
|
||||
}
|
||||
declare const userEvent: {
|
||||
click: (element: Element | Window) => void;
|
||||
dblClick: (element: Element | Window) => void;
|
||||
type: (
|
||||
element: Element | Window,
|
||||
text: string,
|
||||
userOpts?: UserOpts
|
||||
) => Promise<void>;
|
||||
};
|
||||
|
||||
export default userEvent;
|
||||
@ -0,0 +1,11 @@
|
||||
import userEvent, { UserOpts } from "user-event";
|
||||
|
||||
userEvent.click(document.body); // $ExpectType void
|
||||
userEvent.dblClick(window); // $ExpectType void
|
||||
userEvent.type(document.body, "s"); // $ExpectType Promise<void>
|
||||
userEvent.type(document.body, "s", {}); // $ExpectType Promise<void>
|
||||
userEvent.type(document.body, "s", { delay: 5000 }); // $ExpectType Promise<void>
|
||||
userEvent.type(document.body, "s", { allAtOnce: true }); // $ExpectType Promise<void>
|
||||
userEvent.type(document.body, "s", { delay: 1000, allAtOnce: false }); // $ExpectType Promise<void>
|
||||
|
||||
const u: UserOpts = { delay: 20 };
|
||||
16
types/testing-library__user-event/tsconfig.json
Normal file
16
types/testing-library__user-event/tsconfig.json
Normal file
@ -0,0 +1,16 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": ["dom", "es6"],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"strictFunctionTypes": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": ["../"],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": ["index.d.ts", "testing-library__user-event-tests.ts"]
|
||||
}
|
||||
1
types/testing-library__user-event/tslint.json
Normal file
1
types/testing-library__user-event/tslint.json
Normal file
@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
Loading…
Reference in New Issue
Block a user