({
overflow,
scrollHeight
}: {
overflow: string;
scrollHeight: number;
})
| 5 | |
| 6 | describe("isSelfScrolling", () => { |
| 7 | function setup({ |
| 8 | overflow, |
| 9 | scrollHeight |
| 10 | }: { |
| 11 | overflow: string; |
| 12 | scrollHeight: number; |
| 13 | }) { |
| 14 | const element = document.createElement("div"); |
| 15 | // jsdom doesn't expand the overflow shorthand |
| 16 | element.style.overflowY = overflow; |
| 17 | document.body.appendChild(element); |
| 18 | |
| 19 | mockLayout((target) => |
| 20 | target === element |
| 21 | ? { height: 100, left: 0, scrollHeight, top: 0, width: 100 } |
| 22 | : undefined |
| 23 | ); |
| 24 | |
| 25 | return element; |
| 26 | } |
| 27 | |
| 28 | test("should be true if content overflows a scrolling element", () => { |
| 29 | const element = setup({ overflow: "auto", scrollHeight: 200 }); |
no test coverage detected