Fix render's binding to document.body instead of the container.#13
Fix render's binding to document.body instead of the container.#13aranggitoar wants to merge 1 commit intosolidjs:mainfrom aranggitoar:main
Conversation
|
Is this a good pull request format? If there is any standard to comply, please let me know. 😄 |
|
First of all, the PR misses the motivation for the change. Since solid-testing-library is ported from preact-testing-library, it has the same behavior. However, this behavior can confuse developers who are familiar with @testing-library/react, which indeed queries from the container and not from baseElement. The rationale is that one is supposed to use As for the rest of the PR, there's not much meat. Why not directly add the test case, if you already wrote it? In any case, since i moved the testing to vitest and updated a few things, I ended up implementing this myself based on your work. |
Tested with,
The test appends a false container with the same text as the rendered container. It is on the same level with the rendered container, but before the rendered container.
Then it checks if the queried element is the same with the child of
container, which should be the original element. But before the fix it wouldn't be, as the query is bound to the document.body instead of the container. After the fix, it would be, as now the query is bound to the container instead of the document.body.Before fix,

After fix,
