mirror of
https://github.com/callstack/react-native-testing-library.git
synced 2026-09-18 23:09:04 +08:00
feat: deprecate getByName helpers (#66)
This commit is contained in:
committed by
Kacper Wiszczuk
parent
909916e84c
commit
e407ff07ae
@@ -105,22 +105,6 @@ type ReactTestInstance = {
|
||||
};
|
||||
```
|
||||
|
||||
### `getByName: (name: React.ComponentType<*>)`
|
||||
|
||||
A method returning a `ReactTestInstance` with matching a React component type. Throws when no matches.
|
||||
|
||||
### `getAllByName: (name: React.ComponentType<*>)`
|
||||
|
||||
A method returning an array of `ReactTestInstance`s with matching a React component type.
|
||||
|
||||
### `getByType: (type: React.ComponentType<*>)`
|
||||
|
||||
A method returning a `ReactTestInstance` with matching a React component type. Throws when no matches.
|
||||
|
||||
### `getAllByType: (type: React.ComponentType<*>)`
|
||||
|
||||
A method returning an array of `ReactTestInstance`s with matching a React component type.
|
||||
|
||||
### `getByText: (text: string | RegExp)`
|
||||
|
||||
A method returning a `ReactTestInstance` with matching text – may be a string or regular expression. Throws when no matches.
|
||||
@@ -137,6 +121,26 @@ A method returning a `ReactTestInstance` with matching props object. Throws when
|
||||
|
||||
A method returning an array of `ReactTestInstance`s with matching props object.
|
||||
|
||||
### `getByType: (type: React.ComponentType<*>)`
|
||||
|
||||
A method returning a `ReactTestInstance` with matching a React component type. Throws when no matches.
|
||||
|
||||
### `getAllByType: (type: React.ComponentType<*>)`
|
||||
|
||||
A method returning an array of `ReactTestInstance`s with matching a React component type.
|
||||
|
||||
### `[DEPRECATED] getByName: (name: React.ComponentType<*>)`
|
||||
|
||||
A method returning a `ReactTestInstance` with matching a React component type. Throws when no matches.
|
||||
|
||||
> This method has been **deprecated** because using it results in fragile tests that may break between minor React Native versions. It will be removed in next major release (v2.0). Use [`getByType`](#getbytype-type-reactcomponenttype) instead.
|
||||
|
||||
### `[DEPRECATED] getAllByName: (name: React.ComponentType<*>)`
|
||||
|
||||
A method returning an array of `ReactTestInstance`s with matching a React component type.
|
||||
|
||||
> This method has been **deprecated** because using it results in fragile tests that may break between minor React Native versions. It will be removed in next major release (v2.0). Use [`getAllByType`](#getallbytype-type-reactcomponenttype) instead.
|
||||
|
||||
### `update: (element: React.Element<*>) => void`
|
||||
|
||||
Re-render the in-memory tree with a new root element. This simulates a React update at the root. If the new element has the same type and key as the previous element, the tree will be updated; otherwise, it will re-mount a new tree.
|
||||
|
||||
Reference in New Issue
Block a user