mirror of
https://github.com/callstack/react-native-testing-library.git
synced 2026-09-18 23:09:04 +08:00
feat: byA11yValue matcher (#262)
This commit is contained in:
@@ -169,6 +169,11 @@ const getAllByA11yState: Array<ReactTestInstance> = tree.getAllByA11yState({ bus
|
||||
const queryByA11yState: ReactTestInstance = tree.queryByA11yState({ busy: true });
|
||||
const queryAllByA11yState: Array<ReactTestInstance> = tree.queryAllByA11yState({ busy: true });
|
||||
|
||||
const getByA11yValue: ReactTestInstance = tree.getByA11yValue({ min: 10 });
|
||||
const getAllByA11yValue: Array<ReactTestInstance> = tree.getAllByA11yValue({ min: 10 });
|
||||
const queryByA11yValue: ReactTestInstance = tree.queryByA11yValue({ min: 10 });
|
||||
const queryAllByA11yValue: Array<ReactTestInstance> = tree.queryAllByA11yValue({ min: 10 });
|
||||
|
||||
const debugFn = tree.debug();
|
||||
const debugFnWithMessage = tree.debug('my message');
|
||||
|
||||
|
||||
Vendored
+14
@@ -68,6 +68,14 @@ type GetAllReturn = Array<ReactTestInstance>;
|
||||
type QueryReturn = ReactTestInstance | null;
|
||||
type QueryAllReturn = Array<ReactTestInstance> | [];
|
||||
|
||||
// Not yet available in DefinitelyTyped
|
||||
export type A11yValue = {
|
||||
min?: number,
|
||||
max?: number,
|
||||
now?: number,
|
||||
text?: string,
|
||||
};
|
||||
|
||||
type A11yAPI = {
|
||||
// Label
|
||||
getByA11yLabel: (matcher: string | RegExp) => GetReturn,
|
||||
@@ -98,6 +106,12 @@ type A11yAPI = {
|
||||
getAllByA11yState: (matcher: AccessibilityState) => GetAllReturn,
|
||||
queryByA11yState: (matcher: AccessibilityState) => QueryReturn,
|
||||
queryAllByA11yState: (matcher: AccessibilityState) => QueryAllReturn,
|
||||
|
||||
// Value
|
||||
getByA11yValue: (matcher: A11yValue) => GetReturn,
|
||||
getAllByA11yValue: (matcher: A11yValue) => GetAllReturn,
|
||||
queryByA11yValue: (matcher: A11yValue) => QueryReturn,
|
||||
queryAllByA11yValue: (matcher: A11yValue) => QueryAllReturn,
|
||||
};
|
||||
|
||||
export interface Thenable {
|
||||
|
||||
Reference in New Issue
Block a user