Skip to content

Commit 01bc0ee

Browse files
mdjastrzebskithymikee
authored andcommitted
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
1 parent 9fc83fe commit 01bc0ee

File tree

2 files changed

+12
-25
lines changed

2 files changed

+12
-25
lines changed

src/helpers/errors.js

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -39,20 +39,6 @@ export function printDeprecationWarning(functionName: string) {
3939
warned[functionName] = true;
4040
}
4141

42-
export function printUnsafeWarning(functionName: string) {
43-
if (warned[functionName]) {
44-
return;
45-
}
46-
47-
console.warn(`
48-
Deprecation Warning:
49-
${functionName} is not recommended for use and has been renamed to UNSAFE_${functionName}.
50-
In react-native-testing-library 2.x only the UNSAFE_${functionName} name will work.
51-
`);
52-
53-
warned[functionName] = true;
54-
}
55-
5642
export function throwRemovedFunctionError(
5743
functionName: string,
5844
docsRef: string

website/docs/Queries.md

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -203,23 +203,24 @@ const element = getByA11yValue({ min: 40 });
203203

204204
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.
205205

206-
### `UNSAFE_ByType`, `ByType`
206+
### `UNSAFE_ByType`
207207

208-
> Note: added in v1.4
208+
> UNSAFE_getByType, UNSAFE_getAllByType, UNSAFE_queryByType, UNSAFE_queryAllByType
209209
210-
> 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.
210+
Returns a `ReactTestInstance` with matching a React component type.
211211

212-
A method returning a `ReactTestInstance` with matching a React component type. Throws when no matches.
213-
214-
### `UNSAFE_ByProps`, `ByProps`
212+
:::caution
213+
This method has been marked unsafe, since it requires knowledge about implementation details of the component. Use responsibly.
214+
:::
215215

216-
> 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.
216+
### `UNSAFE_ByProps`
217217

218-
A method returning a `ReactTestInstance` with matching props object
218+
> UNSAFE_getByProps, UNSAFE_getAllByProps, UNSAFE_queryByProps, UNSAFE_queryAllByProps
219219
220-
### `ByName`
220+
Returns a `ReactTestInstance` with matching props object.
221221

222-
> 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
223-
> A method returning a `ReactTestInstance` with matching a React component type. Throws when no matches.
222+
:::caution
223+
This method has been marked unsafe, since it requires knowledge about implementation details of the component. Use responsibly.
224+
:::
224225

225226
</details>

0 commit comments

Comments
 (0)