File tree Expand file tree Collapse file tree 3 files changed +18
-19
lines changed Expand file tree Collapse file tree 3 files changed +18
-19
lines changed Original file line number Diff line number Diff line change @@ -9,19 +9,7 @@ export type {keyboardOptions, keyboardKey}
99export function keyboard (
1010 instance : TestInstance ,
1111 text : string ,
12- options ?: Partial < keyboardOptions & { delay : 0 } > ,
13- ) : void
14- export function keyboard (
15- instance : TestInstance ,
16- text : string ,
17- options : Partial <
18- keyboardOptions & { delay : number }
19- > ,
20- ) : Promise < void >
21- export function keyboard (
22- instance : TestInstance ,
23- text : string ,
24- options ?: Partial < keyboardOptions > ,
12+ options ?: Partial < keyboardOptions & { delay : number } > ,
2513) : void | Promise < void > {
2614 const { promise} = keyboardImplementationWrapper ( instance , text , options )
2715
Original file line number Diff line number Diff line change 55 BoundFunctions
66} from 'cli-testing-library'
77import { render , TestInstance } from "../pure" ;
8+ import userEvent from "../../src/user-event" ;
89
910const {
1011 getByText,
@@ -46,6 +47,16 @@ export async function eventTest() {
4647 fireEvent . write ( instance , { value : 'test' } ) ;
4748}
4849
50+ export async function keyboardTest ( ) {
51+ const instance = await render ( 'command' , [ ] ) ;
52+
53+ userEvent . keyboard ( instance , "Test" )
54+ instance . userEvent . keyboard ( "Test" )
55+ await instance . userEvent . keyboard ( "Test" , { delay : 0 } )
56+
57+ fireEvent . write ( instance , { value : 'test' } ) ;
58+ }
59+
4960export async function testWaitFors ( ) {
5061 const instance = await render ( 'command' , [ ] ) ;
5162
Original file line number Diff line number Diff line change 11import type { SpawnOptionsWithoutStdio } from 'child_process'
22import { ChildProcess } from 'node:child_process'
33import type userEvent from '../src/user-event'
4- import type { queries , BoundFunction } from './get-queries-for-instance'
4+ import type { queries , BoundFunction , BoundFunctions } from './get-queries-for-instance'
55
66export interface TestInstance {
77 clear ( ) : void
@@ -21,12 +21,12 @@ export interface RenderOptions {
2121 spawnOpts : Omit < SpawnOptionsWithoutStdio , 'cwd' >
2222}
2323
24+ type UserEvent = typeof userEvent ;
25+
2426export type RenderResult = TestInstance & {
25- userEvent : ReturnType <
26- {
27- [ key in keyof typeof userEvent ] : BoundFunction < typeof userEvent [ key ] >
28- }
29- >
27+ userEvent : {
28+ [ P in keyof UserEvent ] : BoundFunction < UserEvent [ P ] >
29+ }
3030} & { [ P in keyof typeof queries ] : BoundFunction < typeof queries [ P ] > }
3131
3232export function render (
You can’t perform that action at this time.
0 commit comments