MCPcopy Index your code
hub / github.com/nilbuild/driver.js / spyOnScrollIntoView

Function spyOnScrollIntoView

tests/scroll.test.ts:11–18  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

9// scroll behavior can be asserted. jsdom reports a 0×0 box that always counts as
10// in-view, so without this the library never scrolls.
11function spyOnScrollIntoView(): ReturnType<typeof vi.fn> {
12 const el = document.querySelector<HTMLElement>("#intro")!;
13 el.getBoundingClientRect = () =>
14 ({ top: -500, left: 0, right: 0, bottom: -480, width: 0, height: 0, x: 0, y: 0, toJSON() {} }) as DOMRect;
15 const scrollIntoView = vi.fn();
16 el.scrollIntoView = scrollIntoView;
17 return scrollIntoView;
18}
19
20describe("allowScroll", () => {
21 it("allows body scrolling by default", () => {

Callers 1

scroll.test.tsFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…