Cavy/add focus types (#41474)

* add focus function type

* add tests

* change version number
This commit is contained in:
Austin Graham 2020-01-10 17:51:56 -06:00 committed by Armando Aguirre
parent 7f55f31f78
commit d1c81ed0e1
2 changed files with 4 additions and 2 deletions

View File

@ -54,7 +54,7 @@ class SampleComponent extends React.Component<Props> {
<Text>{foo}</Text>
<TextInput ref={generateTestHook('Input', this.setTextInputRef)} />
<TextInput ref={generateTestHook('Input', this.setTextInputRef)} onFocus={() => {}}/>
</View>
);
}
@ -78,6 +78,7 @@ function sampleSpec(spec: TestScope) {
spec.findComponent('View'); // $ExpectType Promise<Component<{}, {}, any>>
spec.press('View'); // $ExpectType Promise<void>
spec.fillIn('Input', 'hello world'); // $ExpectType Promise<void>
spec.focus('Input'); // $ExpectType Promise<void>
spec.pause(1000); // $ExpectType Promise<void>
spec.exists('View'); // $ExpectType Promise<true>
spec.notExists('View.MissingSample'); // $ExpectType Promise<true>

View File

@ -1,4 +1,4 @@
// Type definitions for cavy 3.1
// Type definitions for cavy 3.2
// Project: https://github.com/pixielabs/cavy
// Definitions by: Tyler Hoffman <https://github.com/tyler-hoffman>
// Abigail McPhillips <https://github.com/AbigailMcP>
@ -53,6 +53,7 @@ export class TestScope {
beforeEach(fn: () => void): void;
press(identifier: string): Promise<void>;
fillIn(identifier: string, str: string): Promise<void>;
focus(identifier: string): Promise<void>;
pause(time: number): Promise<void>;
exists(identifier: string): Promise<true>;
notExists(identifier: string): Promise<true>;