Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enhancement: Pass options to scrollIntoView() #15

Open
danDanV1 opened this issue Sep 13, 2019 · 0 comments
Open

Enhancement: Pass options to scrollIntoView() #15

danDanV1 opened this issue Sep 13, 2019 · 0 comments

Comments

@danDanV1
Copy link
Contributor

@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?

danDanV1@2ca1b82

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...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant