test(FN-5012): guard PR-flow CSS against mobile button overrides
Fusion-Task-Id: FN-5012 Fusion-Task-Lineage: e83baffb-76ff-4317-8ff9-e576d5818a9c
This commit is contained in:
committed by
gsxdsm
parent
403a49138d
commit
770b7c8584
@@ -1,6 +1,7 @@
|
||||
import { describe, it, expect, vi } from "vitest";
|
||||
import { render, screen, fireEvent } from "@testing-library/react";
|
||||
import { PrChecksList } from "../PrChecksList";
|
||||
import { loadAllAppCss } from "../../test/cssFixture";
|
||||
|
||||
describe("PrChecksList", () => {
|
||||
it("orders failing checks first", () => {
|
||||
@@ -21,7 +22,27 @@ describe("PrChecksList", () => {
|
||||
expect(items[0]).toHaveTextContent("fail");
|
||||
});
|
||||
|
||||
it("renders summary and details links", () => {
|
||||
it("FN-5012: no mobile .btn overrides; failing details link uses component classes", () => {
|
||||
const css = loadAllAppCss();
|
||||
const mediaStart = css.indexOf("@media (max-width: 768px)");
|
||||
expect(mediaStart).toBeGreaterThan(-1);
|
||||
const blockStart = css.indexOf("{", mediaStart);
|
||||
let depth = 0;
|
||||
let blockEnd = -1;
|
||||
for (let i = blockStart; i < css.length; i += 1) {
|
||||
if (css[i] === "{") depth += 1;
|
||||
if (css[i] === "}") {
|
||||
depth -= 1;
|
||||
if (depth === 0) {
|
||||
blockEnd = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
expect(blockEnd).toBeGreaterThan(blockStart);
|
||||
const mobileBlock = css.slice(blockStart + 1, blockEnd);
|
||||
expect(mobileBlock).not.toMatch(/\.(btn(?:-[a-z]+)?|modal-close)\b/);
|
||||
|
||||
render(
|
||||
<PrChecksList
|
||||
checks={[{ name: "fail", required: true, state: "failure", detailsUrl: "https://example.com/details" }]}
|
||||
@@ -31,6 +52,22 @@ describe("PrChecksList", () => {
|
||||
/>,
|
||||
);
|
||||
|
||||
expect(screen.getByText("0 passing, 1 failing, 0 pending")).toBeInTheDocument();
|
||||
const detailsLink = screen.getByRole("link", { name: /View details/i });
|
||||
expect(detailsLink).toHaveAttribute("href", "https://example.com/details");
|
||||
expect(detailsLink).toHaveClass("pr-checks__details-link", "pr-checks__details-link--failing");
|
||||
expect(detailsLink).not.toHaveClass("btn", "btn-sm");
|
||||
});
|
||||
|
||||
it("renders summary and details links", () => { render(
|
||||
<PrChecksList
|
||||
checks={[{ name: "fail", required: true, state: "failure", detailsUrl: "https://example.com/details" }]}
|
||||
rollup="failure"
|
||||
loading={false}
|
||||
onRefresh={() => {}}
|
||||
/>,
|
||||
);
|
||||
|
||||
expect(screen.getByText("0 passing, 1 failing, 0 pending")).toBeInTheDocument();
|
||||
expect(screen.getByRole("link", { name: /View details/i })).toHaveAttribute("href", "https://example.com/details");
|
||||
});
|
||||
|
||||
@@ -11,7 +11,7 @@ const qualityAppTests = [
|
||||
"app/api/**/*.test.ts",
|
||||
// Representative workflow/component coverage. Exhaustive modal/view suites
|
||||
// stay available in the full `dashboard-app` project.
|
||||
"app/components/__tests__/{ActiveAgentsPanel,AgentMentionPopup,AgentMetricsBar,AgentReflectionsTab,AgentTokenStatsPanel,App,AuthTokenRecoveryDialog,Board,board-mobile-view-switch,ChatView,Column,ConfirmDialog,ConversationHistory,DashboardLoader,DevServerView.mobile,DirectoryPicker,DuplicateWarningModal,ErrorBoundary,ExecutorStatusBar,FileBrowser,FileEditor,GitHubBadge,InlineCreateCard,LoginInstructions,MemoryView,MessageComposer,MobileNavBar,NewTaskModal,NodeCard,NodeHealthDot,NodeStatusIndicator,PrPanel,PrPanel.merge,PrPanel.reviews,ProjectCard,ProjectSelector,ProviderIcon,QuickChatFAB,ReliabilityView,ResearchView,SettingsModal,SettingsModal.worktrunk,StashRecoveryView,TaskCard,TaskCard.badge-height,TaskChangesTab,TaskComments,TaskDetailModal.github-tracking-header,TaskDocumentsTab,TaskForm,TaskIdIntegrityBanner,ThemeSelectorSwatchContract,TrackingRepoSelect,WorktrunkInstallApprovalDetails,WorkflowResultsTab}.test.tsx",
|
||||
"app/components/__tests__/{ActiveAgentsPanel,AgentMentionPopup,AgentMetricsBar,AgentReflectionsTab,AgentTokenStatsPanel,App,AuthTokenRecoveryDialog,Board,board-mobile-view-switch,ChatView,Column,ConfirmDialog,ConversationHistory,DashboardLoader,DevServerView.mobile,DirectoryPicker,DuplicateWarningModal,ErrorBoundary,ExecutorStatusBar,FileBrowser,FileEditor,GitHubBadge,InlineCreateCard,LoginInstructions,MemoryView,MessageComposer,MobileNavBar,NewTaskModal,NodeCard,NodeHealthDot,NodeStatusIndicator,PrChecksList,PrPanel,PrPanel.merge,PrPanel.reviews,ProjectCard,ProjectSelector,ProviderIcon,QuickChatFAB,ReliabilityView,ResearchView,SettingsModal,SettingsModal.worktrunk,StashRecoveryView,TaskCard,TaskCard.badge-height,TaskChangesTab,TaskComments,TaskDetailModal.github-tracking-header,TaskDocumentsTab,TaskForm,TaskIdIntegrityBanner,ThemeSelectorSwatchContract,TrackingRepoSelect,WorktrunkInstallApprovalDetails,WorkflowResultsTab}.test.tsx",
|
||||
// Hooks and utilities are fast, user-visible state/formatting behavior.
|
||||
"app/context/**/*.test.tsx",
|
||||
"app/hooks/__tests__/{useAgents,useAgentLogs,useAppSettings,useAuthOnboarding,useConfirm,useCurrentProject,useNodes,useNodeSettingsSync,useProjects,useQuickChat,useTasks,useTerminalSessions,useTheme,useToast,useUsageData,useViewState}.test.{ts,tsx}",
|
||||
|
||||
Reference in New Issue
Block a user