mirror of
https://github.com/callstack/react-native-testing-library.git
synced 2026-09-18 23:09:04 +08:00
feat: update docs bases on cancelled prepare-2 PR (#335)
* Adapt docs changes from `prepare-2` branch * WIP * Removed unused `printUnsafeWarning` function # Conflicts: # src/helpers/errors.js * Code review changes
This commit is contained in:
committed by
Michał Pierzchała
parent
9fc83fec60
commit
01bc0ee2b4
@@ -39,20 +39,6 @@ export function printDeprecationWarning(functionName: string) {
|
||||
warned[functionName] = true;
|
||||
}
|
||||
|
||||
export function printUnsafeWarning(functionName: string) {
|
||||
if (warned[functionName]) {
|
||||
return;
|
||||
}
|
||||
|
||||
console.warn(`
|
||||
Deprecation Warning:
|
||||
${functionName} is not recommended for use and has been renamed to UNSAFE_${functionName}.
|
||||
In react-native-testing-library 2.x only the UNSAFE_${functionName} name will work.
|
||||
`);
|
||||
|
||||
warned[functionName] = true;
|
||||
}
|
||||
|
||||
export function throwRemovedFunctionError(
|
||||
functionName: string,
|
||||
docsRef: string
|
||||
|
||||
+12
-11
@@ -203,23 +203,24 @@ const element = getByA11yValue({ min: 40 });
|
||||
|
||||
The interface is the same as for other queries, but we won't provide full names so that they're harder to find by search engines.
|
||||
|
||||
### `UNSAFE_ByType`, `ByType`
|
||||
### `UNSAFE_ByType`
|
||||
|
||||
> Note: added in v1.4
|
||||
> UNSAFE_getByType, UNSAFE_getAllByType, UNSAFE_queryByType, UNSAFE_queryAllByType
|
||||
|
||||
> This method has been **deprecated** and has been prepended with `UNSAFE_` prefix. In react-native-testing-library 2.x only the prefixed version will work.
|
||||
Returns a `ReactTestInstance` with matching a React component type.
|
||||
|
||||
A method returning a `ReactTestInstance` with matching a React component type. Throws when no matches.
|
||||
:::caution
|
||||
This method has been marked unsafe, since it requires knowledge about implementation details of the component. Use responsibly.
|
||||
:::
|
||||
|
||||
### `UNSAFE_ByProps`, `ByProps`
|
||||
### `UNSAFE_ByProps`
|
||||
|
||||
> This method has been **deprecated** and has been prepended with `UNSAFE_` prefix. In react-native-testing-library 2.x only the prefixed version will work.
|
||||
> UNSAFE_getByProps, UNSAFE_getAllByProps, UNSAFE_queryByProps, UNSAFE_queryAllByProps
|
||||
|
||||
A method returning a `ReactTestInstance` with matching props object
|
||||
Returns a `ReactTestInstance` with matching props object.
|
||||
|
||||
### `ByName`
|
||||
|
||||
> This method has been **deprecated** because using it results in fragile tests that may break between minor React Native versions. **DON'T USE IT**. It will be removed in next major release (v2.0). Use the other alternatives, such as [`getByText`](#bytext) instead. It's listed here only for back-compat purposes for early adopters of the library
|
||||
> A method returning a `ReactTestInstance` with matching a React component type. Throws when no matches.
|
||||
:::caution
|
||||
This method has been marked unsafe, since it requires knowledge about implementation details of the component. Use responsibly.
|
||||
:::
|
||||
|
||||
</details>
|
||||
|
||||
Reference in New Issue
Block a user