π OpenHands: AI-Driven Development
chore: remove redundant styling assertions and assert semantic attrs instead (#566)
Hiep Le8e90704a5164
diff --git a/__tests__/components/backends/backend-selector.test.tsx b/__tests__/components/backends/backend-selector.test.tsxindex 31fb096c4f..986b2f8c44 100644--- a/__tests__/components/backends/backend-selector.test.tsx+++ b/__tests__/components/backends/backend-selector.test.tsx@@ -733,8 +733,7 @@ describe("BackendSelector", () => {);const settingsButton = screen.getByTestId("backend-selector-settings-link");- expect(settingsButton.className).toContain("bg-tertiary");- expect(settingsButton.className).toContain("text-white");+ expect(settingsButton).toHaveAttribute("data-active", "true");const user = await openDropdown();await user.click(screen.getByText("Local 1"));diff --git a/__tests__/components/features/chat/git-control-bar-repo-button.test.tsx b/__tests__/components/features/chat/git-control-bar-repo-button.test.tsxindex 3799fd5458..46d6ca2f51 100644--- a/__tests__/components/features/chat/git-control-bar-repo-button.test.tsx+++ b/__tests__/components/features/chat/git-control-bar-repo-button.test.tsx@@ -169,7 +169,6 @@ describe("GitControlBarRepoButton", () => {const button = screen.getByRole("button");expect(button).toBeDisabled();- expect(button).toHaveClass("cursor-not-allowed");});it("should be clickable when disabled prop is false", () => {@@ -183,7 +182,6 @@ describe("GitControlBarRepoButton", () => {const button = screen.getByRole("button");expect(button).not.toBeDisabled();- expect(button).toHaveClass("cursor-pointer");});it("should not call onClick when disabled", async () => {diff --git a/__tests__/components/features/chat/open-repository-modal.test.tsx b/__tests__/components/features/chat/open-repository-modal.test.tsxindex c2a74366b3..58b51a7f21 100644--- a/__tests__/components/features/chat/open-repository-modal.test.tsx+++ b/__tests__/components/features/chat/open-repository-modal.test.tsx@@ -306,37 +306,6 @@ describe("OpenRepositoryModal", () => {expect(launchButton).toBeDisabled();});- it("should use small modal width", () => {- render(- <OpenRepositoryModal- isOpen={true}- onClose={mockOnClose}- onLaunch={mockOnLaunch}- />,- );-- // ModalBody with width="small" renders w-[384px]- const modalBody = screen- .getByText("CONVERSATION$OPEN_REPOSITORY")- .closest(".bg-base-secondary");- expect(modalBody).toHaveClass("w-[384px]");- });-- it("should override default gap with !gap-4 for tighter spacing", () => {- render(- <OpenRepositoryModal- isOpen={true}- onClose={mockOnClose}- onLaunch={mockOnLaunch}- />,- );-- const modalBody = screen- .getByText("CONVERSATION$OPEN_REPOSITORY")- .closest(".bg-base-secondary");- expect(modalBody).toHaveClass("!gap-4");- });-describe("provider switching", () => {it("should not show provider dropdown when only one provider exists", () => {mockProviders.current = ["github"];diff --git a/__tests__/components/features/chat/pending-user-messages.test.tsx b/__tests__/components/features/chat/pending-user-messages.test.tsxindex ea8dea15b1..dd00935cce 100644--- a/__tests__/components/features/chat/pending-user-messages.test.tsx+++ b/__tests__/components/features/chat/pending-user-messages.test.tsx@@ -51,7 +51,6 @@ describe("PendingUserMessages", () => {expect(messages[1]).toHaveTextContent("second message");messages.forEach((message) => {expect(message).toHaveAttribute("data-pending-status", "sending");- expect(message.className).toMatch(/opacity-60/);});expect(screen.getAllByTestId("chat-message-sending")).toHaveLength(2);});diff --git a/__tests__/components/features/conversation-panel/conversation-card.test.tsx b/__tests__/components/features/conversation-panel/conversation-card.test.tsxindex 584e261c72..3e9eef37b3 100644--- a/__tests__/components/features/conversation-panel/conversation-card.test.tsx+++ b/__tests__/components/features/conversation-panel/conversation-card.test.tsx@@ -185,14 +185,13 @@ describe("ConversationCard", () => {/>,);- // Context menu is always in the DOM but hidden by CSS classes when contextMenuOpen is false- const contextMenu = screen.queryByTestId("context-menu");- if (contextMenu) {- const contextMenuParent = contextMenu.parentElement;- if (contextMenuParent) {- expect(contextMenuParent).toHaveClass("opacity-0", "invisible");- }- }+ // The closed state is observable via the `data-context-menu-open` attr+ // on the conversation-card root; visual hiding is a CSS consequence+ // covered by the Playwright snapshot suite.+ expect(screen.getByTestId("conversation-card")).toHaveAttribute(+ "data-context-menu-open",+ "false",+ );const ellipsisButton = screen.getByTestId("ellipsis-button");await user.click(ellipsisButton);@@ -303,14 +302,11 @@ describe("ConversationCard", () => {const title = screen.getByTestId("conversation-card-title");expect(title).toBeEnabled();- // Context menu should be hidden after edit button is clicked (check CSS classes on parent div)- const contextMenu = screen.queryByTestId("context-menu");- if (contextMenu) {- const contextMenuParent = contextMenu.parentElement;- if (contextMenuParent) {- expect(contextMenuParent).toHaveClass("opacity-0", "invisible");- }- }+ // Context menu should be closed after edit button is clicked.+ expect(screen.getByTestId("conversation-card")).toHaveAttribute(+ "data-context-menu-open",+ "false",+ );// expect to be focusedexpect(document.activeElement).toBe(title);diff --git a/__tests__/components/features/conversation-panel/conversation-panel.test.tsx b/__tests__/components/features/conversation-panel/conversation-panel.test.tsxindex 7e42b3ef08..d4f220c889 100644--- a/__tests__/components/features/conversation-panel/conversation-panel.test.tsx+++ b/__tests__/components/features/conversation-panel/conversation-panel.test.tsx@@ -333,14 +333,9 @@ describe("ConversationPanel", () => {renderConversationPanel();let cards = await screen.findAllByTestId("conversation-card");- // Delete button should not be visible initially (context menu is closed)- // The context menu is always in the DOM but hidden by CSS classes on the parent div- const contextMenuParent = within(cards[0]).queryByTestId(- "context-menu",- )?.parentElement;- if (contextMenuParent) {- expect(contextMenuParent).toHaveClass("opacity-0", "invisible");- }+ // Closed state is observable via the data-context-menu-open attr on the+ // conversation-card root; visual hiding is covered by Playwright.+ expect(cards[0]).toHaveAttribute("data-context-menu-open", "false");const ellipsisButton = within(cards[0]).getByTestId("ellipsis-button");await user.click(ellipsisButton);@@ -705,14 +700,9 @@ describe("ConversationPanel", () => {// Click outside to close the menuawait user.click(document.body);- // Wait for context menu to close (check CSS classes on parent div)+ // Wait for context menu to close.await waitFor(() => {- const contextMenuParent = within(cards[0]).queryByTestId(- "context-menu",- )?.parentElement;- if (contextMenuParent) {- expect(contextMenuParent).toHaveClass("opacity-0", "invisible");- }+ expect(cards[0]).toHaveAttribute("data-context-menu-open", "false");});// Test STARTING conversation - should show stop button@@ -726,14 +716,9 @@ describe("ConversationPanel", () => {// Click outside to close the menuawait user.click(document.body);- // Wait for context menu to close (check CSS classes on parent div)+ // Wait for context menu to close.await waitFor(() => {- const contextMenuParent = within(cards[1]).queryByTestId(- "context-menu",- )?.parentElement;- if (contextMenuParent) {- expect(contextMenuParent).toHaveClass("opacity-0", "invisible");- }+ expect(cards[1]).toHaveAttribute("data-context-menu-open", "false");});// Test STOPPED conversation - should NOT show stop button@@ -982,14 +967,9 @@ describe("ConversationPanel", () => {const editButton = within(cards[0]).getByTestId("edit-button");await user.click(editButton);- // Wait for context menu to close after edit button click (check CSS classes on parent div)+ // Wait for context menu to close after edit button click.await waitFor(() => {- const contextMenuParent = within(cards[0]).queryByTestId(- "context-menu",- )?.parentElement;- if (contextMenuParent) {- expect(contextMenuParent).toHaveClass("opacity-0", "invisible");- }+ expect(cards[0]).toHaveAttribute("data-context-menu-open", "false");});});diff --git a/__tests__/components/features/conversation-panel/new-conversation-button-cloud.test.tsx b/__tests__/components/features/conversation-panel/new-conversation-button-cloud.test.tsxindex 19937d155b..158eee2735 100644--- a/__tests__/components/features/conversation-panel/new-conversation-button-cloud.test.tsx+++ b/__tests__/components/features/conversation-panel/new-conversation-button-cloud.test.tsx@@ -221,34 +221,6 @@ describe("NewConversationButton (cloud)", () => {expect(screen.getByTestId("cloud-provider-tab-gitlab")).toBeInTheDocument();});- it("applies the pointer-cursor affordance to every interactive popover item", async () => {- mockUseGitRepositories.mockReturnValue({- data: {- pages: [- {- items: [makeRepo("octo/cat", { main_branch: "main" })],- next_page_id: "page-2",- },- ],- },- isLoading: false,- isError: false,- hasNextPage: true,- isFetchingNextPage: false,- fetchNextPage: vi.fn(),- onLoadMore: vi.fn(),- });-- const user = userEvent.setup();- renderWithProviders(<NewConversationButton />);-- await user.click(screen.getByTestId("new-conversation-button"));-- for (const testId of ["launch-repository", "cloud-repo-load-more"]) {- expect(screen.getByTestId(testId)).toHaveClass("cursor-pointer");- }- });-it("shows an empty state when no repositories are returned", async () => {mockUseGitRepositories.mockReturnValue({data: { pages: [{ items: [], next_page_id: null }] },diff --git a/__tests__/components/features/conversation-panel/new-conversation-button.test.tsx b/__tests__/components/features/conversation-panel/new-conversation-button.test.tsxindex feeb83c31c..0d41206364 100644--- a/__tests__/components/features/conversation-panel/new-conversation-button.test.tsx+++ b/__tests__/components/features/conversation-panel/new-conversation-button.test.tsx@@ -188,29 +188,6 @@ describe("NewConversationButton", () => {expect(screen.getByTestId("new-conversation-popover")).toBeInTheDocument();});- it("applies the pointer-cursor affordance to every interactive popover item", async () => {- useWorkspacesStore.getState().addWorkspaces([- {- id: "/workspace/project/repo1",- name: "repo1",- path: "/workspace/project/repo1",- },- ]);- const user = userEvent.setup();- renderWithProviders(<NewConversationButton />);-- await user.click(screen.getByTestId("new-conversation-button"));-- for (const testId of [- "launch-no-workspace",- "launch-workspace",- "add-workspaces-button",- "manage-workspaces-button",- ]) {- expect(screen.getByTestId(testId)).toHaveClass("cursor-pointer");- }- });-it("keeps the popover open when conversation creation fails", async () => {const navigate = vi.fn();const createSpy = vidiff --git a/__tests__/components/features/conversation/conversation-main.test.tsx b/__tests__/components/features/conversation/conversation-main.test.tsxindex b6e853db5d..58e0bb5537 100644--- a/__tests__/components/features/conversation/conversation-main.test.tsx+++ b/__tests__/components/features/conversation/conversation-main.test.tsx@@ -119,23 +119,6 @@ describe("ConversationMain - Layout Transition Stability", () => {expect(screen.getByTestId("chat-interface")).toBeInTheDocument();});- it("does not give the right pane inner content min-w-max so its content stays visible at narrow widths", () => {- // Repro for the bug where dragging the divider very far to the right made- // the right pane appear blank: `min-w-max` made the inner div wider than- // its `overflow-hidden` wrapper, pushing right-aligned tab content out of- // view.- mockIsMobile = false;- mockIsRightPanelShown = true;- mockLeftWidth = 80;-- render(<ConversationMain />);-- const tabsHeader = screen.getByTestId("tabs-pane-header");- const tabsInnerWrapper = tabsHeader.parentElement!;-- expect(tabsInnerWrapper.className).not.toMatch(/(^|\s)min-w-max(\s|$)/);- });-it("survives rapid back-and-forth resize without unmounting ChatInterface", () => {mockIsMobile = false;const { rerender } = render(<ConversationMain />);diff --git a/__tests__/components/features/conversation/conversation-name-context-menu.test.tsx b/__tests__/components/features/conversation/conversation-name-context-menu.test.tsxindex d5ef6db16b..284873c7ea 100644--- a/__tests__/components/features/conversation/conversation-name-context-menu.test.tsx+++ b/__tests__/components/features/conversation/conversation-name-context-menu.test.tsx@@ -52,6 +52,10 @@ function createAnchor(rect: Partial<DOMRect> = {}) {return anchor;}+// The `style.left/top/bottom` assertions in this file verify the numeric+// output of the portal positioning math (anchor rect β menu coordinates).+// They are functional logic checks, not visual styling; visual styling is+// covered by the Playwright snapshot suite.describe("ConversationNameContextMenu portal rendering", () => {afterEach(() => {documentdiff --git a/__tests__/components/features/conversation/conversation-name.test.tsx b/__tests__/components/features/conversation/conversation-name.test.tsxindex 8e9d122a06..7feb47a09b 100644--- a/__tests__/components/features/conversation/conversation-name.test.tsx+++ b/__tests__/components/features/conversation/conversation-name.test.tsx@@ -504,7 +504,7 @@ describe("ConversationNameContextMenu", () => {expect(onShowSkills).toHaveBeenCalledTimes(1);});- it("should apply correct positioning class when position is top", () => {+ it("forwards the position prop as a data-position attribute (top)", () => {const handlers = {onRename: vi.fn(),};@@ -517,11 +517,12 @@ describe("ConversationNameContextMenu", () => {/>,);- const contextMenu = screen.getByTestId("conversation-name-context-menu");- expect(contextMenu).toHaveClass("bottom-full");+ expect(+ screen.getByTestId("conversation-name-context-menu"),+ ).toHaveAttribute("data-position", "top");});- it("should apply correct positioning class when position is bottom", () => {+ it("forwards the position prop as a data-position attribute (bottom)", () => {const handlers = {onRename: vi.fn(),};@@ -534,8 +535,9 @@ describe("ConversationNameContextMenu", () => {/>,);- const contextMenu = screen.getByTestId("conversation-name-context-menu");- expect(contextMenu).toHaveClass("top-full");+ expect(+ screen.getByTestId("conversation-name-context-menu"),+ ).toHaveAttribute("data-position", "bottom");});it("should render correct text content for each menu option", () => {diff --git a/__tests__/components/features/diff-viewer/file-diff-viewer.test.tsx b/__tests__/components/features/diff-viewer/file-diff-viewer.test.tsxindex bc304c3610..b8daf90561 100644--- a/__tests__/components/features/diff-viewer/file-diff-viewer.test.tsx+++ b/__tests__/components/features/diff-viewer/file-diff-viewer.test.tsx@@ -167,18 +167,30 @@ describe("FileDiffViewer", () => {expect(screen.queryByTestId("view-mode-new")).not.toBeInTheDocument();});- it("highlights the active view mode button", async () => {+ it("reflects the active view mode via aria-pressed on the toggle buttons", async () => {const user = userEvent.setup();render(<FileDiffViewer path="src/index.ts" type="M" />);await expand(user);- expect(screen.getByTestId("view-mode-diff").className).toContain("bg-[var(--oh-interactive-hover)] text-white");- expect(screen.getByTestId("view-mode-old").className).not.toContain("bg-[var(--oh-interactive-hover)] text-white");+ expect(screen.getByTestId("view-mode-diff")).toHaveAttribute(+ "aria-pressed",+ "true",+ );+ expect(screen.getByTestId("view-mode-old")).toHaveAttribute(+ "aria-pressed",+ "false",+ );await user.click(screen.getByTestId("view-mode-old"));- expect(screen.getByTestId("view-mode-old").className).toContain("bg-[var(--oh-interactive-hover)] text-white");- expect(screen.getByTestId("view-mode-diff").className).not.toContain("bg-[var(--oh-interactive-hover)] text-white");+ expect(screen.getByTestId("view-mode-old")).toHaveAttribute(+ "aria-pressed",+ "true",+ );+ expect(screen.getByTestId("view-mode-diff")).toHaveAttribute(+ "aria-pressed",+ "false",+ );});});diff --git a/__tests__/components/features/home/home-header.test.tsx b/__tests__/components/features/home/home-header.test.tsxindex a8b1fa2579..66ae4d1de7 100644--- a/__tests__/components/features/home/home-header.test.tsx+++ b/__tests__/components/features/home/home-header.test.tsx@@ -47,10 +47,4 @@ describe("HomeHeader", () => {expect(header).toBeInTheDocument();});- it("should have the correct CSS classes for layout", () => {- renderHomeHeader();-- const header = screen.getByRole("banner");- expect(header).toHaveClass("flex", "flex-col", "items-center");- });});diff --git a/__tests__/components/features/markdown/table.test.tsx b/__tests__/components/features/markdown/table.test.tsxindex 32195d34a0..df9686dcce 100644--- a/__tests__/components/features/markdown/table.test.tsx+++ b/__tests__/components/features/markdown/table.test.tsx@@ -15,9 +15,6 @@ describe("table (markdown)", () => {const table = screen.getByRole("table");expect(table).toBeInTheDocument();- // border-collapse + border is what makes columns visually separate- expect(table).toHaveClass("border-collapse");- expect(table).toHaveClass("border");});it("should wrap the table in a horizontally scrollable container", () => {@@ -31,7 +28,7 @@ describe("table (markdown)", () => {expect(wrapper?.querySelector("table")).not.toBeNull();});- it("should render header cells as styled <th> elements", () => {+ it("should render header cells as <th> elements with correct content", () => {render(<MarkdownRenderer>{GFM_TABLE}</MarkdownRenderer>);const headers = screen.getAllByRole("columnheader");@@ -39,26 +36,15 @@ describe("table (markdown)", () => {expect(headers[0]).toHaveTextContent("Feature");expect(headers[1]).toHaveTextContent("OpenAI Codex");expect(headers[2]).toHaveTextContent("Claude Code");- // Padding + border is what was missing before the fix- headers.forEach((h) => {- expect(h).toHaveClass("border");- expect(h).toHaveClass("px-3");- expect(h).toHaveClass("py-2");- });});- it("should render body cells as styled <td> elements", () => {+ it("should render body cells as <td> elements with correct content", () => {render(<MarkdownRenderer>{GFM_TABLE}</MarkdownRenderer>);const cells = screen.getAllByRole("cell");expect(cells).toHaveLength(6);expect(cells[0]).toHaveTextContent("CLI");expect(cells[3]).toHaveTextContent("Mobile");- cells.forEach((c) => {- expect(c).toHaveClass("border");- expect(c).toHaveClass("px-3");- expect(c).toHaveClass("py-2");- });});it("should not render table markdown as plain paragraph text", () => {diff --git a/__tests__/components/features/settings/mcp-settings/mcp-server-list.test.tsx b/__tests__/components/features/settings/mcp-settings/mcp-server-list.test.tsxindex 9e75f24483..05261ab8b8 100644--- a/__tests__/components/features/settings/mcp-settings/mcp-server-list.test.tsx+++ b/__tests__/components/features/settings/mcp-settings/mcp-server-list.test.tsx@@ -40,7 +40,6 @@ describe("MCPServerList", () => {// Check that the table structure is renderedconst table = screen.getByRole("table");expect(table).toBeInTheDocument();- expect(table).toHaveClass("w-full");// Check that server items are renderedconst serverItems = screen.getAllByTestId("mcp-server-item");@@ -96,11 +95,6 @@ describe("MCPServerList", () => {// Check that the URL is properly displayed with title attribute for accessibilityconst detailsCells = screen.getAllByTitle(longUrlServer.url);expect(detailsCells).toHaveLength(2); // Name and Details columns both have the URL-- // Check that both name and details cells use truncation and have title for tooltip- const [nameCell, detailsCell] = detailsCells;- expect(nameCell).toHaveClass("truncate");- expect(detailsCell).toHaveClass("truncate");});it("should display command and arguments for STDIO servers", () => {diff --git a/__tests__/components/features/settings/settings-nav-divider.test.tsx b/__tests__/components/features/settings/settings-nav-divider.test.tsxindex 634c1bdef6..eae40e8793 100644--- a/__tests__/components/features/settings/settings-nav-divider.test.tsx+++ b/__tests__/components/features/settings/settings-nav-divider.test.tsx@@ -12,12 +12,14 @@ describe("SettingsNavDivider", () => {expect(divider).toBeInTheDocument();});+ // Prop-passthrough contract: consumer-supplied className must land on the+ // element. Visual styling is covered by the Playwright snapshot suite.it("should accept custom className", () => {// Arrange & Act- const { container } = render(<SettingsNavDivider className="my-4" />);+ const { container } = render(<SettingsNavDivider className="custom-class" />);// Assertconst divider = container.firstChild;- expect(divider).toHaveClass("my-4");+ expect(divider).toHaveClass("custom-class");});});diff --git a/__tests__/components/features/settings/settings-nav-header.test.tsx b/__tests__/components/features/settings/settings-nav-header.test.tsxindex fb5085b160..8d58c59075 100644--- a/__tests__/components/features/settings/settings-nav-header.test.tsx+++ b/__tests__/components/features/settings/settings-nav-header.test.tsx@@ -12,17 +12,17 @@ describe("SettingsNavHeader", () => {).toBeInTheDocument();});+ // Prop-passthrough contract: consumer-supplied className must land on the+ // element. Visual styling is covered by the Playwright snapshot suite.it("should accept custom className", () => {const { container } = render(<SettingsNavHeadertext={I18nKey.SETTINGS$PERSONAL_SETTINGS_HEADER}- className="px-2 pt-2 pb-1"+ className="custom-class"/>,);const wrapper = container.firstChild;- expect(wrapper).toHaveClass("px-2");- expect(wrapper).toHaveClass("pt-2");- expect(wrapper).toHaveClass("pb-1");+ expect(wrapper).toHaveClass("custom-class");});});diff --git a/__tests__/components/features/sidebar/sidebar.test.tsx b/__tests__/components/features/sidebar/sidebar.test.tsxindex b3f7b73609..3c0663b61c 100644--- a/__tests__/components/features/sidebar/sidebar.test.tsx+++ b/__tests__/components/features/sidebar/sidebar.test.tsx@@ -183,32 +183,6 @@ describe("Sidebar", () => {window.localStorage.clear();});- it.each([- ["/conversations"],- ["/automations"],- ["/automations/abc-123"],- ["/settings"],- ["/"],- ])(- "does not add md top padding to the sidebar shell on %s",- (currentPath) => {- renderSidebar(currentPath);-- const sidebar = screen.getByRole("navigation").parentElement;- expect(sidebar?.className).not.toMatch(/(^|\s)md:pt-4(\s|$)/);- expect(sidebar?.className).not.toMatch(/(^|\s)md:pt-6\.5(\s|$)/);- },- );-- it("renders inactive sidebar nav links with the muted token color", () => {- renderSidebar("/skills");-- const conversationsLink = screen.getByTestId("sidebar-conversations-link");- expect(conversationsLink.className).toMatch(- /(^|\s)text-\[var\(--oh-muted\)\](\s|$)/,- );- });-it("toggles between expanded and collapsed states and persists the choice", () => {const { unmount } = renderSidebar("/conversations");@@ -274,19 +248,6 @@ describe("Sidebar", () => {expect(navigate).toHaveBeenCalledWith("/settings");});- it("opts the collapsed Settings button into cursor-pointer so hovering it shows the pointer affordance", () => {- // Arrange: render with the sidebar collapsed so the Settings icon is mounted.- window.localStorage.setItem("openhands-sidebar-collapsed", "true");- renderSidebar("/conversations");-- // Act: locate the Settings button the user hovers.- const settingsButton = screen.getByTestId("collapsed-settings-link");-- // Assert: Tailwind v4 preflight resets <button> cursor to default, so- // the button must opt back into cursor-pointer for the hover affordance.- expect(settingsButton.className).toMatch(/(^|\s)cursor-pointer(\s|$)/);- });-it("opens the backend popover when hovering the collapsed backend icon", async () => {window.localStorage.setItem("openhands-sidebar-collapsed", "true");renderSidebar("/conversations");diff --git a/__tests__/components/modals/settings/model-selector.test.tsx b/__tests__/components/modals/settings/model-selector.test.tsxindex 215c0c115c..a471234ece 100644--- a/__tests__/components/modals/settings/model-selector.test.tsx+++ b/__tests__/components/modals/settings/model-selector.test.tsx@@ -137,9 +137,4 @@ describe("ModelSelector", () => {});});- it("should stretch the provider and model selectors across the full row", () => {- const { container } = renderWithQuery(<ModelSelector />);-- expect(container.firstChild).toHaveClass("w-full");- });});diff --git a/__tests__/components/onboarding/onboarding-modal.test.tsx b/__tests__/components/onboarding/onboarding-modal.test.tsxindex a11619fa45..2340742f24 100644--- a/__tests__/components/onboarding/onboarding-modal.test.tsx+++ b/__tests__/components/onboarding/onboarding-modal.test.tsx@@ -91,25 +91,10 @@ describe("OnboardingModal", () => {screen.getByTestId("onboarding-step-choose-agent"),).toBeInTheDocument();- // Active slide sits at offset 0; later slides are translated 100%- // per index away to the right and absolute-positioned so they- // don't bleed into the modal box.expect(screen.getByTestId("onboarding-slide-0")).toHaveAttribute("data-active","true",);- expect(screen.getByTestId("onboarding-slide-0").style.transform).toBe(- "translateX(0%)",- );- expect(screen.getByTestId("onboarding-slide-1").style.transform).toBe(- "translateX(100%)",- );- expect(screen.getByTestId("onboarding-slide-2").style.transform).toBe(- "translateX(200%)",- );- expect(screen.getByTestId("onboarding-slide-3").style.transform).toBe(- "translateX(300%)",- );// Progress bar reflects step 1 of 4.expect(screen.getByTestId("onboarding-progress-step-0")).toHaveAttribute(@@ -138,15 +123,6 @@ describe("OnboardingModal", () => {"data-active","true",);- expect(screen.getByTestId("onboarding-slide-0").style.transform).toBe(- "translateX(-100%)",- );- expect(screen.getByTestId("onboarding-slide-1").style.transform).toBe(- "translateX(0%)",- );- expect(screen.getByTestId("onboarding-slide-2").style.transform).toBe(- "translateX(100%)",- );// Once the backend health probe resolves, step 1's Next is enabled.await waitFor(() =>@@ -172,9 +148,6 @@ describe("OnboardingModal", () => {"data-active","true",);- expect(screen.getByTestId("onboarding-slide-3").style.transform).toBe(- "translateX(0%)",- );});it("Skip immediately closes the modal", async () => {@@ -187,18 +160,6 @@ describe("OnboardingModal", () => {expect(onClose).toHaveBeenCalledTimes(1);});- it("opts the Skip button into cursor-pointer so hovering it shows the pointer affordance", () => {- // Arrange: render the modal so the Skip button is mounted.- renderModal();-- // Act: locate the Skip button the user hovers.- const skipButton = screen.getByTestId("onboarding-skip");-- // Assert: Tailwind v4 preflight resets <button> cursor to default, so- // the button must opt back into cursor-pointer for the hover affordance.- expect(skipButton.className).toMatch(/(^|\s)cursor-pointer(\s|$)/);- });-it("wraps the slide rail in a dedicated scroll region so the modal chrome stays put", () => {// Arrange + act: render the modal once.renderModal();diff --git a/__tests__/components/settings/llm-profiles/profile-actions-menu.test.tsx b/__tests__/components/settings/llm-profiles/profile-actions-menu.test.tsxindex 0919e8a00b..59ba44f788 100644--- a/__tests__/components/settings/llm-profiles/profile-actions-menu.test.tsx+++ b/__tests__/components/settings/llm-profiles/profile-actions-menu.test.tsx@@ -173,11 +173,11 @@ describe("ProfileActionsMenu", () => {expect(menuItems).toHaveLength(4);});- it("Delete button has red text styling", () => {+ it("marks the Delete menu item as destructive", () => {render(<ProfileActionsMenu {...defaultProps} />);const deleteButton = screen.getByTestId("profile-delete");- expect(deleteButton).toHaveClass("text-red-400");+ expect(deleteButton).toHaveAttribute("data-destructive", "true");});it("does not call onClose when clicking inside the menu container", () => {diff --git a/__tests__/components/settings/llm-profiles/profile-name-input.test.tsx b/__tests__/components/settings/llm-profiles/profile-name-input.test.tsxindex 1a2f13896c..b26332fcbc 100644--- a/__tests__/components/settings/llm-profiles/profile-name-input.test.tsx+++ b/__tests__/components/settings/llm-profiles/profile-name-input.test.tsx@@ -75,63 +75,79 @@ describe("ProfileNameInput", () => {expect(screen.getByTestId("profile-name")).toHaveValue("my-profile");});- it("shows rule text in gray for valid names", () => {+ it("marks the input as valid for valid names", () => {render(<ProfileNameInput+ testId="profile-name"value="valid-name"onChange={() => {}}- ruleTestId="rule-text"/>,);- const rule = screen.getByTestId("rule-text");- expect(rule).toHaveClass("text-[var(--oh-muted)]");- expect(rule).not.toHaveClass("text-red-400");+ expect(screen.getByTestId("profile-name")).toHaveAttribute(+ "aria-invalid",+ "false",+ );});- it("shows rule text in red for invalid names", () => {+ it("marks the input as invalid for names starting with a special character", () => {render(<ProfileNameInput+ testId="profile-name"value=".invalid-start"onChange={() => {}}- ruleTestId="rule-text"/>,);- const rule = screen.getByTestId("rule-text");- expect(rule).toHaveClass("text-red-400");- expect(rule).not.toHaveClass("text-[var(--oh-muted)]");+ expect(screen.getByTestId("profile-name")).toHaveAttribute(+ "aria-invalid",+ "true",+ );});- it("shows rule text in gray for empty value (treated as valid)", () => {+ it("treats an empty optional value as valid", () => {render(- <ProfileNameInput value="" onChange={() => {}} ruleTestId="rule-text" />,+ <ProfileNameInput+ testId="profile-name"+ value=""+ onChange={() => {}}+ />,);- const rule = screen.getByTestId("rule-text");- expect(rule).toHaveClass("text-[var(--oh-muted)]");+ expect(screen.getByTestId("profile-name")).toHaveAttribute(+ "aria-invalid",+ "false",+ );});- it("shows rule text in red for whitespace-only value", () => {+ it("marks whitespace-only values as invalid", () => {render(- <ProfileNameInput value=" " onChange={() => {}} ruleTestId="rule-text" />,+ <ProfileNameInput+ testId="profile-name"+ value=" "+ onChange={() => {}}+ />,);- const rule = screen.getByTestId("rule-text");- expect(rule).toHaveClass("text-red-400");+ expect(screen.getByTestId("profile-name")).toHaveAttribute(+ "aria-invalid",+ "true",+ );});- it("validates names with special characters as invalid", () => {+ it("marks names containing disallowed characters as invalid", () => {render(<ProfileNameInput+ testId="profile-name"value="name with spaces"onChange={() => {}}- ruleTestId="rule-text"/>,);- const rule = screen.getByTestId("rule-text");- expect(rule).toHaveClass("text-red-400");+ expect(screen.getByTestId("profile-name")).toHaveAttribute(+ "aria-invalid",+ "true",+ );});it("can be disabled", () => {@@ -200,81 +216,100 @@ describe("ProfileNameInput", () => {const name64 = "a".repeat(64);render(<ProfileNameInput+ testId="profile-name"value={name64}onChange={() => {}}- ruleTestId="rule"/>,);- // Valid names show gray rule text- expect(screen.getByTestId("rule")).toHaveClass("text-[var(--oh-muted)]");+ expect(screen.getByTestId("profile-name")).toHaveAttribute(+ "aria-invalid",+ "false",+ );});it("rejects 65 character names", () => {const name65 = "a".repeat(65);render(<ProfileNameInput+ testId="profile-name"value={name65}onChange={() => {}}- ruleTestId="rule"/>,);- // Invalid names show red rule text- expect(screen.getByTestId("rule")).toHaveClass("text-red-400");+ expect(screen.getByTestId("profile-name")).toHaveAttribute(+ "aria-invalid",+ "true",+ );});it("accepts names starting with numbers", () => {render(<ProfileNameInput+ testId="profile-name"value="1profile"onChange={() => {}}- ruleTestId="rule"/>,);- expect(screen.getByTestId("rule")).toHaveClass("text-[var(--oh-muted)]");+ expect(screen.getByTestId("profile-name")).toHaveAttribute(+ "aria-invalid",+ "false",+ );});it("accepts names with all allowed special characters", () => {render(<ProfileNameInput+ testId="profile-name"value="valid.name_with-chars"onChange={() => {}}- ruleTestId="rule"/>,);- expect(screen.getByTestId("rule")).toHaveClass("text-[var(--oh-muted)]");+ expect(screen.getByTestId("profile-name")).toHaveAttribute(+ "aria-invalid",+ "false",+ );});it("rejects names starting with special characters", () => {render(<ProfileNameInput+ testId="profile-name"value=".invalid"onChange={() => {}}- ruleTestId="rule"/>,);- expect(screen.getByTestId("rule")).toHaveClass("text-red-400");+ expect(screen.getByTestId("profile-name")).toHaveAttribute(+ "aria-invalid",+ "true",+ );});it("rejects names starting with hyphen", () => {render(<ProfileNameInput+ testId="profile-name"value="-invalid"onChange={() => {}}- ruleTestId="rule"/>,);- expect(screen.getByTestId("rule")).toHaveClass("text-red-400");+ expect(screen.getByTestId("profile-name")).toHaveAttribute(+ "aria-invalid",+ "true",+ );});it("rejects names starting with underscore", () => {render(<ProfileNameInput+ testId="profile-name"value="_invalid"onChange={() => {}}- ruleTestId="rule"/>,);- expect(screen.getByTestId("rule")).toHaveClass("text-red-400");+ expect(screen.getByTestId("profile-name")).toHaveAttribute(+ "aria-invalid",+ "true",+ );});});});diff --git a/__tests__/components/settings/llm-profiles/rename-profile-modal.test.tsx b/__tests__/components/settings/llm-profiles/rename-profile-modal.test.tsxindex f85508fbee..1234f08a1b 100644--- a/__tests__/components/settings/llm-profiles/rename-profile-modal.test.tsx+++ b/__tests__/components/settings/llm-profiles/rename-profile-modal.test.tsx@@ -167,7 +167,7 @@ describe("RenameProfileModal", () => {expect(submitButton).toBeDisabled();});- it("shows validation error styling for invalid names", async () => {+ it("marks the input as invalid for names violating the format rule", async () => {const user = userEvent.setup();renderModal(mockProfile);@@ -175,8 +175,7 @@ describe("RenameProfileModal", () => {await user.clear(input);await user.type(input, ".invalid-name");- const rule = screen.getByTestId("rename-profile-rule");- expect(rule).toHaveClass("text-red-400");+ expect(input).toHaveAttribute("aria-invalid", "true");});it("updates input value when a different profile is passed", () => {diff --git a/__tests__/routes/files-tab.test.tsx b/__tests__/routes/files-tab.test.tsxindex 5b84294cc8..758ed26ef1 100644--- a/__tests__/routes/files-tab.test.tsx+++ b/__tests__/routes/files-tab.test.tsx@@ -319,13 +319,11 @@ describe("FilesTab", () => {expect(screen.queryByTestId("file-content-viewer-iframe"),).not.toBeInTheDocument();-- // The rich-rendered markdown container must paint the right-pane bg- // color (so it blends with the surrounding chrome) and project white- // text β both spelled out in the user's design ask.- const container = screen.getByTestId("file-content-viewer-markdown");- expect(container.className).toContain("bg-[var(--oh-surface)]");- expect(container.className).toContain("text-white");+ // The rich-rendered markdown container is mounted (visual styling of+ // this container is covered by the Playwright snapshot suite).+ expect(+ screen.getByTestId("file-content-viewer-markdown"),+ ).toBeInTheDocument();});it("shows highlighted source (not rich markdown) when toggled to plain on a .md", async () => {diff --git a/__tests__/routes/task-list-tab.test.tsx b/__tests__/routes/task-list-tab.test.tsxindex 0b9153cde1..2c5906a12a 100644--- a/__tests__/routes/task-list-tab.test.tsx+++ b/__tests__/routes/task-list-tab.test.tsx@@ -103,7 +103,7 @@ describe("TaskListTab", () => {expect(screen.queryByText(/task-1/)).not.toBeInTheDocument();});- it("highlights in_progress tasks with a background", () => {+ it("marks in_progress tasks as active via data-active", () => {setTasks([{ id: "1", title: "Todo task", status: "todo" },{ id: "2", title: "Active task", status: "in_progress" },@@ -113,19 +113,20 @@ describe("TaskListTab", () => {render(<TaskListTab />);// Find each task item via its text, then check the wrapper div- const activeItem = screen.getByText("Active task").closest("[data-name]");- const activeWrapper = activeItem?.parentElement;- expect(activeWrapper?.className).toContain("oh-surface-raised");-- const todoItem = screen.getByText("Todo task").closest("[data-name]");- expect(todoItem?.parentElement?.className).not.toContain(- "oh-surface-raised",- );-- const doneItem = screen.getByText("Done task").closest("[data-name]");- expect(doneItem?.parentElement?.className).not.toContain(- "oh-surface-raised",- );+ const activeWrapper = screen+ .getByText("Active task")+ .closest("[data-name]")?.parentElement;+ expect(activeWrapper).toHaveAttribute("data-active", "true");++ const todoWrapper = screen+ .getByText("Todo task")+ .closest("[data-name]")?.parentElement;+ expect(todoWrapper).toHaveAttribute("data-active", "false");++ const doneWrapper = screen+ .getByText("Done task")+ .closest("[data-name]")?.parentElement;+ expect(doneWrapper).toHaveAttribute("data-active", "false");});it("displays task notes when present and omits when absent", () => {diff --git a/__tests__/ui/card.test.tsx b/__tests__/ui/card.test.tsxindex 88a266cb96..61033d1dd6 100644--- a/__tests__/ui/card.test.tsx+++ b/__tests__/ui/card.test.tsx@@ -15,6 +15,8 @@ describe("Card", () => {expect(screen.getByTestId("test-card")).toBeInTheDocument();});+ // Prop-passthrough contract: consumer-supplied className must land on the+ // element. Visual styling is covered by the Playwright snapshot suite.it("should apply custom className", () => {render(<Card testId="test-card" className="custom-class">@@ -24,131 +26,4 @@ describe("Card", () => {expect(screen.getByTestId("test-card")).toHaveClass("custom-class");});-- describe("theme variants", () => {- it("should apply default theme styles", () => {- render(<Card testId="test-card">Content</Card>);-- const card = screen.getByTestId("test-card");- expect(card).toHaveClass("bg-[var(--oh-surface)]");- expect(card).toHaveClass("border-[var(--oh-border)]");- expect(card).toHaveClass("rounded-xl");- });-- it("should apply outlined theme styles", () => {- render(- <Card testId="test-card" theme="outlined">- Content- </Card>,- );-- const card = screen.getByTestId("test-card");- expect(card).toHaveClass("bg-transparent");- expect(card).toHaveClass("border-[var(--oh-border)]");- });-- it("should apply dark theme styles", () => {- render(- <Card testId="test-card" theme="dark">- Content- </Card>,- );-- const card = screen.getByTestId("test-card");- expect(card).toHaveClass("bg-black");- expect(card).toHaveClass("border-[var(--oh-border-subtle)]");- expect(card).toHaveClass("rounded-2xl");- });- });-- describe("hover variants", () => {- it("should not apply hover styles when hover is none", () => {- render(- <Card testId="test-card" hover="none">- Content- </Card>,- );-- const card = screen.getByTestId("test-card");- expect(card).not.toHaveClass("hover:bg-[linear-gradient");- });-- it("should apply elevated hover styles", () => {- render(- <Card testId="test-card" hover="elevated">- Content- </Card>,- );-- const card = screen.getByTestId("test-card");- expect(card).toHaveClass("transition-all");- expect(card).toHaveClass("duration-200");- });- });-- describe("gradient variants", () => {- it("should not apply gradient styles when gradient is none", () => {- render(- <Card testId="test-card" gradient="none">- Content- </Card>,- );-- const card = screen.getByTestId("test-card");- expect(card.className).not.toContain("--cool-grey-975");- });-- it("should apply standard gradient styles", () => {- render(- <Card testId="test-card" gradient="standard">- Content- </Card>,- );-- const card = screen.getByTestId("test-card");- expect(card.className).toContain("--cool-grey-975");- expect(card.className).toContain("--cool-grey-925");- });- });-- describe("combined variants", () => {- it("should apply dark theme with standard gradient", () => {- render(- <Card testId="test-card" theme="dark" gradient="standard">- Content- </Card>,- );-- const card = screen.getByTestId("test-card");- // Should have dark theme base- expect(card).toHaveClass("border-[var(--oh-border-subtle)]");- expect(card).toHaveClass("rounded-2xl");- // Should have gradient overlay- expect(card.className).toContain("--cool-grey-975");- });-- it("should apply dark theme with elevated hover", () => {- render(- <Card testId="test-card" theme="dark" hover="elevated">- Content- </Card>,- );-- const card = screen.getByTestId("test-card");- expect(card).toHaveClass("rounded-2xl");- expect(card).toHaveClass("transition-all");- });- });-- it("should have flex display by default", () => {- render(<Card testId="test-card">Content</Card>);-- expect(screen.getByTestId("test-card")).toHaveClass("flex");- });-- it("should have relative positioning", () => {- render(<Card testId="test-card">Content</Card>);-- expect(screen.getByTestId("test-card")).toHaveClass("relative");- });});diff --git a/src/components/features/backends/backend-selector.tsx b/src/components/features/backends/backend-selector.tsxindex d2daafdd2c..b315acd7db 100644--- a/src/components/features/backends/backend-selector.tsx+++ b/src/components/features/backends/backend-selector.tsx@@ -311,6 +311,7 @@ export function BackendSelector({<buttontype="button"data-testid="backend-selector-settings-link"+ data-active={isSettingsActive}aria-label={t(I18nKey.SIDEBAR$SETTINGS)}onClick={() => navigate("/settings")}className={diff --git a/src/components/features/diff-viewer/editor-container.test.tsx b/src/components/features/diff-viewer/editor-container.test.tsxindex 6204bf56ab..b4cf114bb1 100644--- a/src/components/features/diff-viewer/editor-container.test.tsx+++ b/src/components/features/diff-viewer/editor-container.test.tsx@@ -21,6 +21,8 @@ describe("EditorContainer", () => {expect(screen.getByTestId("editor-container")).toBeInTheDocument();});+ // Functional contract: the `height` prop is observable only via the+ // `--editor-height` CSS custom property the component writes to the DOM.it("sets the --editor-height CSS variable based on height prop", () => {render(<EditorContainer height={500}>@@ -30,15 +32,4 @@ describe("EditorContainer", () => {const container = screen.getByTestId("editor-container");expect(container.style.getPropertyValue("--editor-height")).toBe("500px");});-- it("applies border and overflow styles", () => {- render(- <EditorContainer height={400}>- <div data-testid="inner" />- </EditorContainer>,- );- const container = screen.getByTestId("editor-container");- expect(container.className).toContain("border");- expect(container.className).toContain("overflow-hidden");- });});diff --git a/src/components/features/diff-viewer/file-diff-viewer.tsx b/src/components/features/diff-viewer/file-diff-viewer.tsxindex 2ac84fc245..7b4924e2ce 100644--- a/src/components/features/diff-viewer/file-diff-viewer.tsx+++ b/src/components/features/diff-viewer/file-diff-viewer.tsx@@ -224,6 +224,7 @@ export function FileDiffViewer({ path, type }: FileDiffViewerProps) {key={mode}data-testid={`view-mode-${mode}`}type="button"+ aria-pressed={viewMode === mode}onClick={() => setViewMode(mode)}className={cn("p-1 rounded transition-colors cursor-pointer",diff --git a/src/components/features/settings/llm-profiles/profile-actions-menu.tsx b/src/components/features/settings/llm-profiles/profile-actions-menu.tsxindex 7c7894acf7..71e560e3d7 100644--- a/src/components/features/settings/llm-profiles/profile-actions-menu.tsx+++ b/src/components/features/settings/llm-profiles/profile-actions-menu.tsx@@ -19,6 +19,7 @@ interface MenuItemProps {disabled?: boolean;className?: string;testId: string;+ destructive?: boolean;}function MenuItem({@@ -30,6 +31,7 @@ function MenuItem({disabled,className,testId,+ destructive,}: MenuItemProps) {return (<button@@ -48,6 +50,7 @@ function MenuItem({)}role="menuitem"data-testid={testId}+ data-destructive={destructive ? "true" : undefined}>{label}</button>@@ -218,6 +221,7 @@ export function ProfileActionsMenu({menuItemsRef={menuItemsRef}className="text-red-400"testId="profile-delete"+ destructive/></div>);diff --git a/src/routes/task-list-tab.tsx b/src/routes/task-list-tab.tsxindex bdf96a5993..1634c102fb 100644--- a/src/routes/task-list-tab.tsx+++ b/src/routes/task-list-tab.tsx@@ -23,6 +23,7 @@ function TaskListTab() {{taskList.map((task) => (<divkey={task.id}+ data-active={task.status === "in_progress" ? "true" : "false"}className={cn("px-4 py-2",task.status === "in_progress" && "bg-[var(--oh-surface-raised)]",diff --git a/src/ui/context-menu.tsx b/src/ui/context-menu.tsxindex 4d31d629bb..be93c99026 100644--- a/src/ui/context-menu.tsx+++ b/src/ui/context-menu.tsx@@ -71,6 +71,7 @@ export function ContextMenu({return (<uldata-testid={testId}+ data-position={position}ref={ref}className={cn(contextMenuVariants({