Skip to content

feat: update docs bases on cancelled prepare-2 PR #335

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
May 19, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 0 additions & 14 deletions src/helpers/errors.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
23 changes: 12 additions & 11 deletions website/docs/Queries.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.

### `UNSAFE_ByProps`, `ByProps`
:::caution
This method has been marked unsafe, since it requires knowledge about implementation details of the component. Use responsibly.
:::

> 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_ByProps`

A method returning a `ReactTestInstance` with matching props object
> UNSAFE_getByProps, UNSAFE_getAllByProps, UNSAFE_queryByProps, UNSAFE_queryAllByProps

### `ByName`
Returns a `ReactTestInstance` with matching props object.

> 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>