SmoothScroll causes bugs in test bundle

This is my project (work in progress).

I am using to make scrolling to anchor links smoother. It seems to interact badly with the test bundle.

1. The navbar should always be at the top of the viewport.

The above test fails when running the product landing page test suite. But when I remove smoothscroll, it works.

window.scroll is not a function

It seems like SmoothScroll is overwriting the meaning of window.scroll and causing the error. Is there any way you could make this test pass?

Welcome to the forum. You have a few options.

  1. Use let or const when declaring the scroll variable.

  2. Name the scroll variable something else.

  3. Scope your code inside a IIFE.

1 Like

Thanks for the response. I was under the impression that it was the smoothScroll package itself that was overwriting the variable, I had totally forgot I defined the variable in app.js :slight_smile: