firefox-devtools / firefox-devtools/profiler

Consider that we stop using `container` in favor of `document.body` in tests

Open
#3,306 0 comments 0 reactions 0 assignees View on GitHub
code maintenance tests
Dominant language
TypeScript
Stars
1.5k
Forks
491
Avg merge
3d 46m
Merged PRs (30d)
27

Description

In #3305 I disabled the new eslint test that checks when we use `container`. We do use `container` in tests for these cases:

1. snapshot tests
1. use of `querySelector` and friends

Advantages of using `document.body`:

* this is standard DOM
* we don't need to forward `container` from the `render` result to the test code
* there's no difference with fragments or portals when doing queries
* the queries `getByText` and friends are using `document.body` already.

Drawbacks of using `document.body`:

* for Flow `document.body` can be `null`, so this can be painful to use `ensureExists` or `$FlowExpectError` eveywhere.
* more nested output in snapshots

┆Issue is synchronized with this [Jira Task](https://mozilla-hub.atlassian.net/browse/FP-383)

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.