emberjs / emberjs/ember-test-helpers

Add reseting `ember-testing-container` scroll position during render()

Open
#729 5 comments 2 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
188
Forks
254
PR merge metrics
No merged PRs in 30d

Description

Expectation: When you use `render()` the DOM should be in a clean state and there shouldn't be any leftover DOM state of scrollbar positions.

Result: if you are scrolling elements into view during tests, and then doing subsequent `clearRender()` and `render()` within the same test, the scroll position of `ember-testing-container` is not reset.

Would you be open to a pull request for adding the following into the `render()` or `clearRender()` helpers?
`getRootElement().parentElement.scrollTo(0, 0);`

Since `clearRender()` is mostly concerned with triggering teardown behaviour, my vote would be to add a call to reset scroll in `render()` on line 107.

https://github.com/emberjs/ember-test-helpers/blob/5c4f7025cf530273b7fc240adec04a5a24113c57/addon-test-support/%40ember/test-helpers/setup-rendering-context.ts#L107

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.