fix(ui/chat): wrap TokenInput children in flex row and fix placeholder

This commit is contained in:
sam committed 2026-11-25 23:06:46 +11:00
1 parent 56dbb31923
commit 7904ccdfe0
3 files changed
+81 -52

No files matched your search

+38 -7
View File
@@ -186,18 +186,49 @@ test("chat More menu opens on screen and its items run", { timeout: 90000 }, asy
await cdp.send("Emulation.setDeviceMetricsOverride", { width: 1280, height: 900, deviceScaleFactor: 1, mobile: false });
await cdp.send("Page.navigate", { url: `http://127.0.0.1:${vitePort}/` });
// Wait for the app shell and the collapsed dock, then expand it.
await cdp.evaluate(`(async () => {
// Wait for the app shell and the collapsed dock, verify the minimised
// composer stays on one horizontal row with its placeholder, then expand it.
const collapsed = await cdp.evaluate(`(async () => {
const sleep = (ms) => new Promise((r) => setTimeout(r, ms));
for (let i = 0; i < 60; i++) {
if (document.querySelector('button[aria-label="Show conversation"]')) {
document.querySelector('button[aria-label="Show conversation"]').click();
for (let j = 0; j < 40 && !document.querySelector('button[aria-label="More"]'); j++) await sleep(250);
return !!document.querySelector('button[aria-label="More"]');
const show = document.querySelector('button[aria-label="Show conversation"]');
if (show) {
const handle = document.querySelector('[data-move-handle]');
const editor = document.querySelector('[data-slot="token-input-editor"]');
if (!handle || !editor) return { ready: false };
const hr = handle.getBoundingClientRect();
const er = editor.getBoundingClientRect();
const sr = show.getBoundingClientRect();
const placeholder = getComputedStyle(editor, "::before").content;
return {
ready: true,
handleMidY: hr.y + hr.height / 2,
editorMidY: er.y + er.height / 2,
showMidY: sr.y + sr.height / 2,
horizontalOrder: hr.right <= er.left + 1 && er.right <= sr.left + 1,
placeholder,
};
}
await sleep(250);
}
return false;
return { ready: false };
})()`);
assert.equal(collapsed.ready, true, "the collapsed chat dock rendered");
assert.equal(collapsed.horizontalOrder, true, `minimised composer controls stay on one horizontal row, got ${JSON.stringify(collapsed)}`);
assert.ok(
Math.abs(collapsed.handleMidY - collapsed.editorMidY) < 8 && Math.abs(collapsed.showMidY - collapsed.editorMidY) < 8,
`minimised composer controls align vertically on one row, got ${JSON.stringify(collapsed)}`,
);
assert.ok(
typeof collapsed.placeholder === "string" && collapsed.placeholder.includes("Message Archie"),
`empty composer shows its placeholder, got ${JSON.stringify(collapsed.placeholder)}`,
);
await cdp.evaluate(`(async () => {
const sleep = (ms) => new Promise((r) => setTimeout(r, ms));
document.querySelector('button[aria-label="Show conversation"]').click();
for (let j = 0; j < 40 && !document.querySelector('button[aria-label="More"]'); j++) await sleep(250);
return !!document.querySelector('button[aria-label="More"]');
})()`).then((expanded: unknown) => assert.equal(expanded, true, "the chat dock expanded and rendered the More button"));
// Pick the open conversation first, so the menu's actions have a