Skip to content

Commit 87c1754

Browse files
committed
test(app): unpin with the scroll a wheel causes
1 parent 75e2818 commit 87c1754

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

‎packages/app/component-tests/timeline-virtualizer.spec.ts‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -110,15 +110,17 @@ story("leaves a reader who scrolled up in place after a scroll to the zoomed end
110110

111111
await root.getByRole("button", { name: "Scroll to end", exact: true }).click()
112112
await frames()
113-
await viewport.dispatchEvent("wheel", { deltaY: -1 })
114-
await expect(root.getByTestId("timeline-controls")).toHaveAttribute("data-pinned", "false")
113+
// The wheel and the scroll it causes arrive together. A wheel alone would leave an earlier arrival at the end free to
114+
// pin again once that scroll settles.
115115
await viewport.evaluate(
116116
(element) =>
117117
new Promise((resolve) => {
118118
element.addEventListener("scroll", resolve, { once: true })
119+
element.dispatchEvent(new WheelEvent("wheel", { deltaY: -1, bubbles: true }))
119120
element.scrollTop -= 40
120121
}),
121122
)
123+
await expect(root.getByTestId("timeline-controls")).toHaveAttribute("data-pinned", "false")
122124
const height = await viewport.evaluate((element) => element.scrollHeight)
123125
await root.getByRole("button", { name: "Grow last row", exact: true }).click()
124126
await expect.poll(() => viewport.evaluate((element) => element.scrollHeight)).toBeGreaterThan(height + 30)

0 commit comments

Comments
 (0)