MCPcopy Create free account
hub / github.com/Alphanimble/htmlstream / mockScrollEl

Function mockScrollEl

tests/hold-stream.test.ts:118–131  ·  view source on GitHub ↗
(scrollTop: number, scrollHeight: number, clientHeight: number)

Source from the content-addressed store, hash-verified

116
117describe("syncStreamScrollFollow", () => {
118 function mockScrollEl(scrollTop: number, scrollHeight: number, clientHeight: number) {
119 const el = document.createElement("div");
120 let top = scrollTop;
121 Object.defineProperty(el, "scrollTop", {
122 configurable: true,
123 get: () => top,
124 set: (value: number) => {
125 top = value;
126 },
127 });
128 Object.defineProperty(el, "scrollHeight", { configurable: true, value: scrollHeight });
129 Object.defineProperty(el, "clientHeight", { configurable: true, value: clientHeight });
130 return el;
131 }
132
133 it("pauses when the reader scrolls up", () => {
134 const el = mockScrollEl(100, 1000, 400);

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected