feat(chat): refine V2 conversation UI (#5307)
This commit is contained in:
1 parent
2a6f05fb43
commit
22d79b30ff
30 files changed
+596
-150
No files matched your search
@@ -26,6 +26,28 @@ function renderControl(scripts: ReadonlyArray<ProjectScript>) {
|
||||
);
|
||||
}
|
||||
|
||||
function renderPanelControlWithImportedAction() {
|
||||
return renderToStaticMarkup(
|
||||
<ProjectScriptsControl
|
||||
displayMode="panel"
|
||||
scripts={[]}
|
||||
fileScripts={[
|
||||
{
|
||||
name: "Setup Worktree",
|
||||
command: "vp i",
|
||||
icon: "configure",
|
||||
runOnWorktreeCreate: true,
|
||||
},
|
||||
]}
|
||||
keybindings={EMPTY_KEYBINDINGS}
|
||||
onRunScript={() => {}}
|
||||
onAddScript={async () => undefined as never}
|
||||
onUpdateScript={async () => undefined as never}
|
||||
onDeleteScript={async () => undefined as never}
|
||||
/>,
|
||||
);
|
||||
}
|
||||
|
||||
function buttonTag(html: string, ariaLabel: string) {
|
||||
return html.match(new RegExp(`<button[^>]*aria-label="${ariaLabel}"[^>]*>`))?.[0];
|
||||
}
|
||||
@@ -62,4 +84,16 @@ describe("ProjectScriptsControl compact controls", () => {
|
||||
'class="sr-only @3xl/header-actions:not-sr-only @3xl/header-actions:ml-0.5"',
|
||||
);
|
||||
});
|
||||
|
||||
it("renders available project actions as a full panel row", () => {
|
||||
const html = renderPanelControlWithImportedAction();
|
||||
const primary = buttonTag(html, "Project actions");
|
||||
const menuTrigger = buttonTag(html, "Choose project action");
|
||||
|
||||
expect(primary).toContain("flex-1");
|
||||
expect(primary).toContain("justify-start");
|
||||
expect(menuTrigger).toContain("w-8");
|
||||
expect(html).toContain("h-4 w-px");
|
||||
expect(html).toContain(">Actions</span>");
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user