fix(webui): keep permission hints outside locked-thread drafts
This commit is contained in:
1 parent
2b7d686117
commit
0bd8456076
4 files changed
+86
-22
No files matched your search
@@ -6,10 +6,10 @@ test.beforeEach(async ({ page }) => {
|
||||
await page.route("**/api/commands", route => route.fulfill({ json: { commands: [] } }));
|
||||
});
|
||||
|
||||
for (const width of [1280, 390]) for (const variant of ["hero", "thread"]) for (const permission of ["Full Access", "Default Permission"]) {
|
||||
for (const width of [1280, 390]) for (const variant of ["hero", "thread", "locked-thread"]) for (const permission of ["Full Access", "Default Permission"]) {
|
||||
test(`${variant} ${permission} hint avoids short and multiline drafts at ${width}px`, async ({ page }) => {
|
||||
await page.setViewportSize({ width, height: 900 });
|
||||
await page.goto(`/browser/fixture.html?case=${variant === "hero" ? "new-chat-skeleton" : "mobile-chat-layout&project"}`);
|
||||
await page.goto(`/browser/fixture.html?case=${variant === "hero" ? "new-chat-skeleton" : variant === "thread" ? "mobile-chat-layout&project" : "mobile-chat-layout&no-context"}`);
|
||||
const input = page.getByRole("textbox", { name: "Message input" });
|
||||
const access = page.locator(".thread-composer-access");
|
||||
const hint = page.locator("[data-radix-popper-content-wrapper] > [data-state]");
|
||||
@@ -28,6 +28,12 @@ for (const width of [1280, 390]) for (const variant of ["hero", "thread"]) for (
|
||||
expect(bounds.y >= editor.y + editor.height || bounds.y + bounds.height <= editor.y).toBe(true);
|
||||
expect(bounds.x).toBeGreaterThanOrEqual(0);
|
||||
expect(bounds.x + bounds.width).toBeLessThanOrEqual(width);
|
||||
expect(bounds.y).toBeGreaterThanOrEqual(0);
|
||||
expect(bounds.y + bounds.height).toBeLessThanOrEqual(900);
|
||||
if (await hint.getAttribute("data-side") === "top") {
|
||||
const composer = (await page.locator(".thread-composer-form").boundingBox())!;
|
||||
expect(bounds.y + bounds.height).toBeLessThanOrEqual(composer.y - 7);
|
||||
}
|
||||
if (trigger.y + trigger.height + bounds.height + 16 <= 900) {
|
||||
expect(bounds.y).toBeGreaterThanOrEqual(trigger.y + trigger.height + 7);
|
||||
}
|
||||
@@ -36,3 +42,24 @@ for (const width of [1280, 390]) for (const variant of ["hero", "thread"]) for (
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
test("a visible permission hint stays above the composer as a locked-thread draft grows", async ({ page }) => {
|
||||
await page.setViewportSize({ width: 1280, height: 600 });
|
||||
await page.goto("/browser/fixture.html?case=mobile-chat-layout&no-context");
|
||||
const input = page.getByRole("textbox", { name: "Message input" });
|
||||
const hint = page.locator("[data-radix-popper-content-wrapper] > [data-state]");
|
||||
await input.fill("Keep this draft visible.");
|
||||
await page.locator(".thread-composer-access").hover();
|
||||
await expect(hint).toBeVisible();
|
||||
await expect(hint).toHaveAttribute("data-side", "top");
|
||||
await page.keyboard.insertText("\nKeep this draft visible.".repeat(12));
|
||||
await expect(input).toHaveValue("Keep this draft visible." + "\nKeep this draft visible.".repeat(12));
|
||||
await expect.poll(async () => {
|
||||
const bounds = (await hint.boundingBox())!;
|
||||
const composer = (await page.locator(".thread-composer-form").boundingBox())!;
|
||||
return composer.y - bounds.y - bounds.height;
|
||||
}).toBeGreaterThanOrEqual(7);
|
||||
const bounds = (await hint.boundingBox())!;
|
||||
expect(bounds.y).toBeGreaterThanOrEqual(0);
|
||||
});
|
||||
Reference in new issue
Block a user