mirror of
https://github.com/paperclipai/paperclip.git
synced 2026-10-25 02:26:12 +02:00
Fix assignee picker no-match state
This commit is contained in:
1 parent
2726476362
commit
d530c32d95
2 files changed
+52
-2
No files matched your search
@@ -460,6 +460,53 @@ describe("IssueProperties", () => {
|
||||
act(() => root.unmount());
|
||||
});
|
||||
|
||||
it("filters the no-assignee option with assignee search", async () => {
|
||||
mockAgentsApi.list.mockResolvedValue([
|
||||
{
|
||||
id: "agent-1",
|
||||
name: "ClaudeCoder",
|
||||
role: "",
|
||||
title: null,
|
||||
icon: null,
|
||||
status: "active",
|
||||
orgChainHealth: { status: "ok" },
|
||||
} as unknown as Parameters<typeof mockAgentsApi.list.mockResolvedValue>[0][number],
|
||||
]);
|
||||
const root = renderProperties(container, {
|
||||
issue: createIssue(),
|
||||
childIssues: [],
|
||||
onUpdate: vi.fn(),
|
||||
});
|
||||
await flush();
|
||||
|
||||
const searchInput = container.querySelector(
|
||||
'input[placeholder="Search assignees..."]',
|
||||
) as HTMLInputElement | null;
|
||||
expect(searchInput).not.toBeNull();
|
||||
|
||||
await act(async () => {
|
||||
const nativeSetter = Object.getOwnPropertyDescriptor(HTMLInputElement.prototype, "value")?.set;
|
||||
nativeSetter?.call(searchInput, "no");
|
||||
searchInput!.dispatchEvent(new Event("input", { bubbles: true }));
|
||||
});
|
||||
await flush();
|
||||
|
||||
expect(container.textContent).toContain("No assignee");
|
||||
expect(container.textContent).not.toContain("No matches.");
|
||||
|
||||
await act(async () => {
|
||||
const nativeSetter = Object.getOwnPropertyDescriptor(HTMLInputElement.prototype, "value")?.set;
|
||||
nativeSetter?.call(searchInput, "zzzz");
|
||||
searchInput!.dispatchEvent(new Event("input", { bubbles: true }));
|
||||
});
|
||||
await flush();
|
||||
|
||||
expect(container.textContent).not.toContain("No assignee");
|
||||
expect(container.textContent).toContain("No matches.");
|
||||
|
||||
act(() => root.unmount());
|
||||
});
|
||||
|
||||
it("always exposes the add sub-issue action", async () => {
|
||||
const onAddSubIssue = vi.fn();
|
||||
const root = renderProperties(container, {
|
||||
|
||||
@@ -1431,6 +1431,7 @@ export function IssueProperties({
|
||||
const visibleAgentOptions = agentAssigneeOptions.filter((option) =>
|
||||
matchesAssigneeSearch(option.label, option.searchText),
|
||||
);
|
||||
const showNoAssigneeOption = matchesAssigneeSearch("No assignee", "");
|
||||
const sectionHeader = (text: string) => (
|
||||
<div className="px-2 pb-0.5 pt-1.5 text-[10px] font-medium uppercase tracking-wider text-muted-foreground">
|
||||
{text}
|
||||
@@ -1467,7 +1468,9 @@ export function IssueProperties({
|
||||
autoFocus={!inline}
|
||||
/>
|
||||
<div className="max-h-56 overflow-y-auto overscroll-contain">
|
||||
{renderAssigneeOption({ kind: "none", value: "", label: "No assignee", searchText: "" })}
|
||||
{showNoAssigneeOption
|
||||
? renderAssigneeOption({ kind: "none", value: "", label: "No assignee", searchText: "" })
|
||||
: null}
|
||||
{visibleAgentOptions.length > 0 ? (
|
||||
<>
|
||||
{sectionHeader("Agents")}
|
||||
@@ -1480,7 +1483,7 @@ export function IssueProperties({
|
||||
{visibleUserOptions.map((option) => renderAssigneeOption(option))}
|
||||
</>
|
||||
) : null}
|
||||
{visibleAgentOptions.length === 0 && visibleUserOptions.length === 0 ? (
|
||||
{!showNoAssigneeOption && visibleAgentOptions.length === 0 && visibleUserOptions.length === 0 ? (
|
||||
<div className="px-2 py-2 text-xs text-muted-foreground">No matches.</div>
|
||||
) : null}
|
||||
</div>
|
||||
|
||||
Reference in new issue
Block a user