(popoverOffset: number)
| 389 | // tests the feature (offset distances the popover from the element) without |
| 390 | // hard-coding the full positioning formula. |
| 391 | async function topForOffset(popoverOffset: number): Promise<number> { |
| 392 | const el = document.querySelector<HTMLElement>("#intro")!; |
| 393 | el.getBoundingClientRect = () => rect({ top: 400, left: 400, right: 600, bottom: 420, width: 200, height: 20 }); |
| 394 | el.scrollIntoView = () => {}; |
| 395 | |
| 396 | const d = createDriver({ animate: false, popoverOffset }); |
| 397 | d.highlight({ element: "#intro", popover: { title: "Intro", side: "top" } }); |
| 398 | |
| 399 | const wrapper = popoverEl() as HTMLElement; |
| 400 | wrapper.getBoundingClientRect = () => rect({}); |
| 401 | d.refresh(); |
| 402 | await nextFrame(); |
| 403 | |
| 404 | const top = parseFloat(wrapper.style.top); |
| 405 | d.destroy(); |
| 406 | return top; |
| 407 | } |
| 408 | |
| 409 | it("moves the popover further from the element as the offset grows", async () => { |
| 410 | const near = await topForOffset(10); |
no test coverage detected
searching dependent graphs…