Merge remote-tracking branch 'gh/main' into fix/oplp-tile-cursor
# Conflicts: # context/test-evidence/clients.md
This commit is contained in:
@@ -132,4 +132,30 @@ test.describe("the help overlay draws the shared content", () => {
|
||||
await expect(rows_.last().locator("td.selected")).toHaveCount(1);
|
||||
await expect(page.locator("#grid tbody td.selected")).toHaveCount(1);
|
||||
});
|
||||
|
||||
// improvise-1c5m. Below the width at which the app bar wraps, `#help` covers
|
||||
// `#hint`, and Welcome itself says nothing about paging. The contract: the
|
||||
// mode's own hint is UNCOVERED somewhere while help is open.
|
||||
test("a narrow window still shows how to page through help", async ({ page }) => {
|
||||
await page.setViewportSize({ width: 600, height: 800 });
|
||||
await openHelp(page);
|
||||
|
||||
// The string is the page's own `#hint`, i.e. `hint_line(Help)`; this spec
|
||||
// spells no keys. Asserting it names paging keeps an empty hint out.
|
||||
const hint = (await page.locator("#hint").textContent()).trim();
|
||||
expect(hint).toContain("next-page");
|
||||
|
||||
// An element showing exactly that string, topmost at its own centre: the
|
||||
// overlay covering `#hint` is precisely what `elementFromPoint` sees.
|
||||
const uncovered = await page.evaluate((text) =>
|
||||
[...document.querySelectorAll("body *")].some((node) => {
|
||||
if (node.children.length > 0 || node.textContent.trim() !== text) return false;
|
||||
const r = node.getBoundingClientRect();
|
||||
if (r.width === 0 || r.height === 0) return false;
|
||||
const top = document.elementFromPoint(r.left + r.width / 2, r.top + r.height / 2);
|
||||
return top !== null && (top === node || node.contains(top));
|
||||
}),
|
||||
hint);
|
||||
expect(uncovered, "the paging hint is under the help overlay").toBe(true);
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user