garris / garris/ember-backstop
Enhancement: Pass options to scrollIntoView()
- Dominant language
- JavaScript
- Stars
- 57
- Forks
- 20
- PR merge metrics
- No merged PRs in 30d
Description
@garris do you think this is something that would belong in master or do you expect this type of functionality to exist in the consumer's space?
https://github.com/edeis53/ember-backstop/commit/2ca1b8265c1c0a8ffaf722cf409780e24cace065
`scenario.scrollToSelector` uses `scrollIntoView()` under the hood, and sometimes you need use the options supported by `scrollIntoView()`
eg.
```
element.scrollIntoView({
block: "end",
inline: "end"
});
```
Implementation
```
const options = {
scenario: {
scrollToSelector: "#myid",
scrollIntoViewOptions: {
block: "end",
inline: "end"
}
}
}
await backstop(assert, options);
```
It's a pity that in the scenario option in backstopjs itself is called `scrollToSelector` because it's not calling `window.scrollTo`.
Something like this would have clearer semantics:
```
{
scenario: {
scrollIntoView: {
selector: "#myid",
options: {
block: "end",
inline: "end"
}
}
}
}
```
but that'd be a breaking change in the scenario settings...
Contributor guide
Research direction
Start by locating the implementation of scenario.scrollToSelector, which uses scrollIntoView(), and inspect the surrounding scenario-option handling. Confirm how scrollIntoViewOptions should be accepted while preserving existing behavior, then run the relevant tests and verify scenarios can use the requested block and inline options.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- testing
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100