feat(webui): refine sidebar hierarchy and selection feedback
This commit is contained in:
1 parent
da749b4a87
commit
39a817e72d
8 files changed
+220
-147
No files matched your search
@@ -94,13 +94,9 @@ describe("ChatList", () => {
|
||||
expect(underline?.getAttribute("style"))
|
||||
.toContain(sessionHandleColor("handle_1234"));
|
||||
|
||||
const activeTrack = conversation.querySelector("[data-sidebar-selection-track]");
|
||||
expect(activeTrack).toHaveClass(
|
||||
"origin-left",
|
||||
"scale-x-100",
|
||||
"transition-transform",
|
||||
"motion-reduce:transition-none",
|
||||
);
|
||||
expect(conversation.closest("[data-chat-row]"))
|
||||
.toHaveClass("rounded-xl");
|
||||
expect(conversation.querySelector("[data-sidebar-selection-track]")).toBeNull();
|
||||
});
|
||||
|
||||
it("marks a conversation that needs recovery attention with a warning indicator", () => {
|
||||
@@ -683,25 +679,21 @@ describe("ChatList", () => {
|
||||
expect(tabHeader).not.toHaveAttribute("data-chat-row");
|
||||
expect(tabHeader).not.toHaveAttribute("data-sidebar-pane");
|
||||
expect(tabButton).not.toHaveAttribute("aria-current");
|
||||
expect(tabButton.querySelector(".lucide-folder-tree")).toBeInTheDocument();
|
||||
expect(tabHeader.querySelector(".lucide-folder-tree")).toBeNull();
|
||||
const paneList = within(tabGroup).getByRole("list", { name: "Panes in Root topic" });
|
||||
expect(tabSurface).toContainElement(paneList);
|
||||
const activePane = within(tabGroup).getByRole("button", { name: "Research pane" });
|
||||
expect(activePane).toHaveAttribute("aria-current", "true");
|
||||
expect(activePane.closest("[data-sidebar-pane]")).toHaveClass("rounded-control");
|
||||
expect(activePane.querySelector("[data-sidebar-selection-track]"))
|
||||
.toHaveAttribute("data-active", "true");
|
||||
expect(activePane.closest("[data-sidebar-pane]")).toHaveClass("rounded-xl");
|
||||
expect(screen.getByTestId("chats-selection-highlight"))
|
||||
.toHaveAttribute("data-active-id", "websocket:root");
|
||||
expect(screen.getByRole("button", {
|
||||
name: "Research pane pane actions",
|
||||
})).toHaveClass("opacity-0");
|
||||
expect(within(tabGroup).getByRole("button", { name: "Root topic" }))
|
||||
.not.toHaveAttribute("aria-current");
|
||||
expect(tabGroup).not.toHaveTextContent("2/4");
|
||||
expect(paneList).toHaveClass(
|
||||
"rounded-es-[14px]",
|
||||
"border-s-2",
|
||||
"border-sidebar-foreground/25",
|
||||
);
|
||||
expect(paneList).toHaveClass("ms-4");
|
||||
|
||||
const collapse = within(tabGroup).getByRole("button", {
|
||||
name: "Collapse panes in Root topic",
|
||||
@@ -1025,11 +1017,7 @@ describe("ChatList", () => {
|
||||
);
|
||||
|
||||
expect(screen.getByRole("region", { name: "nanobot-bench" })).toBeInTheDocument();
|
||||
expect(projectSurface).toHaveClass(
|
||||
"rounded-es-[16px]",
|
||||
"border-s-2",
|
||||
"border-sidebar-foreground/10",
|
||||
);
|
||||
expect(projectSurface).toHaveClass("ms-4");
|
||||
expect(within(nanobotSection).getByText("Alpha task")).toBeInTheDocument();
|
||||
expect(
|
||||
within(nanobotSection)
|
||||
@@ -1090,7 +1078,7 @@ describe("ChatList", () => {
|
||||
expect(within(chatsSection).queryByText("Project chat")).not.toBeInTheDocument();
|
||||
});
|
||||
|
||||
it("grows and retracts the row-owned selection track", () => {
|
||||
it("moves the selected background between topic rows", () => {
|
||||
const props = {
|
||||
sessions: [
|
||||
session({ chatId: "active", title: "Active topic" }),
|
||||
@@ -1112,10 +1100,9 @@ describe("ChatList", () => {
|
||||
|
||||
const activeButton = screen.getByRole("button", { name: "Active topic" });
|
||||
expect(activeButton).toHaveAttribute("aria-current", "page");
|
||||
expect(activeButton.querySelector("[data-sidebar-selection-track]"))
|
||||
.toHaveClass("origin-left", "scale-x-100", "transition-transform");
|
||||
expect(activeButton.querySelector("[data-sidebar-selection-track]"))
|
||||
.toHaveStyle({ backgroundColor: "currentColor" });
|
||||
expect(screen.getByTestId("chats-selection-highlight"))
|
||||
.toHaveAttribute("data-active-id", "websocket:active");
|
||||
expect(activeButton.querySelector("[data-sidebar-selection-track]")).toBeNull();
|
||||
|
||||
rerender(
|
||||
<ChatList
|
||||
@@ -1129,11 +1116,10 @@ describe("ChatList", () => {
|
||||
expect(screen.getByRole("button", { name: "Inactive topic" }))
|
||||
.toHaveAttribute("aria-current", "page");
|
||||
expect(screen.getByRole("button", { name: "Active topic" })
|
||||
.querySelector("[data-sidebar-selection-track]"))
|
||||
.toHaveClass("scale-x-0");
|
||||
expect(screen.getByRole("button", { name: "Inactive topic" })
|
||||
.querySelector("[data-sidebar-selection-track]"))
|
||||
.toHaveClass("scale-x-100");
|
||||
.closest("[data-chat-row]"))
|
||||
.not.toHaveClass("bg-sidebar-foreground/[0.055]");
|
||||
expect(screen.getByTestId("chats-selection-highlight"))
|
||||
.toHaveAttribute("data-active-id", "websocket:inactive");
|
||||
});
|
||||
|
||||
it("restores collapsed tabs from the local UI preference", () => {
|
||||
@@ -1282,9 +1268,9 @@ describe("ChatList", () => {
|
||||
"ease-out",
|
||||
"motion-reduce:transition-none",
|
||||
);
|
||||
expect(expandedIcon).not.toHaveClass("rotate-90");
|
||||
expect(expandedIcon).not.toHaveClass("-rotate-90");
|
||||
expect(screen.getByRole("button", { name: "Topic actions for Alpha project" })
|
||||
.compareDocumentPosition(disclosureButton) & Node.DOCUMENT_POSITION_FOLLOWING)
|
||||
.compareDocumentPosition(disclosureButton) & Node.DOCUMENT_POSITION_PRECEDING)
|
||||
.toBeTruthy();
|
||||
|
||||
fireEvent.click(disclosureButton);
|
||||
@@ -1296,7 +1282,7 @@ describe("ChatList", () => {
|
||||
|
||||
expect(screen.getByRole("button", { name: "Projects: Alpha project" })
|
||||
.querySelector("[data-sidebar-project-disclosure-icon]"))
|
||||
.toHaveClass("rotate-90");
|
||||
.toHaveClass("-rotate-90");
|
||||
expect(projectButton).toHaveAttribute("aria-expanded", "false");
|
||||
expect(animate).toHaveBeenCalledWith(
|
||||
[
|
||||
|
||||
@@ -569,7 +569,7 @@ describe("ThreadShell", () => {
|
||||
/>,
|
||||
));
|
||||
|
||||
expect(within(portal).getByText("@soro")).toBeInTheDocument();
|
||||
expect(within(portal).queryByText("@soro")).not.toBeInTheDocument();
|
||||
expect(screen.queryByLabelText("Session @soro")).not.toBeInTheDocument();
|
||||
|
||||
unmount();
|
||||
|
||||
Reference in new issue
Block a user