Skip to content

Commit 28add87

Browse files
committed
refactor: self code review
1 parent 04c42b1 commit 28add87

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

src/__tests__/render.test.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,7 @@ test('returns host root', () => {
212212
expect(root.props.testID).toBe('inner');
213213
});
214214

215-
test('returns UNSAFE_root', () => {
215+
test('returns composite UNSAFE_root', () => {
216216
const { UNSAFE_root } = render(<View testID="inner" />);
217217

218218
expect(UNSAFE_root).toBeDefined();

website/docs/API.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -258,7 +258,7 @@ Get the rendered component JSON representation, e.g. for snapshot testing.
258258
root: ReactTestInstance;
259259
```
260260

261-
Returns the rendered root host element.
261+
Returns the rendered root [host element](testing-env#host-and-composite-components).
262262

263263
This API is primarily useful in component tests, as it allows you to access root host view without using `ByTestId` queries or similar methods.
264264

@@ -268,14 +268,14 @@ This API is primarily useful in component tests, as it allows you to access root
268268
UNSAFE_root: ReactTestInstance;
269269
```
270270

271-
Returns the rendered root element.
271+
Returns the rendered [composite root element](testing-env#host-and-composite-components).
272272

273273
::caution
274274
This API typically will return a composite view which goes against recommended testing practices. This API is primarily available for legacy test suits that rely on such testing.
275275
::
276276

277277
::note
278-
Previously this API has been named `container` for compatibility with React Testing Library. However, despite the same name, the actual behavior has been signficantly different, hence the name change to `UNSAFE_root`.
278+
This API has been previously named `container` for compatibility with [React Testing Library](https://testing-library.com/docs/react-testing-library/api#container-1). However, despite the same name, the actual behavior has been signficantly different, hence the name change to `UNSAFE_root`.
279279
::
280280

281281
## `screen`

0 commit comments

Comments
 (0)