**UI Fixes (TDD approach - tests first, then implementation):** - Resolution steps: improved text contrast (text-foreground vs muted) - DocEditor preview: added text-foreground class for readability - History page: fixed domain display (category field) with better contrast - Audit Log: added expandable rows with View/Hide buttons to show transmitted data - Dashboard & buttons: already had proper contrast with outline variant - Export document: fixed missing title/content parameters in command signature **Tests Added (13 new tests, all passing):** - tests/unit/resolution.test.tsx - resolution steps contrast - tests/unit/docEditor.test.tsx - preview mode and export buttons - tests/unit/exportDocument.test.ts - export parameters validation - tests/unit/history.test.tsx - domain display and filtering - tests/unit/dashboard.test.tsx - refresh button visibility - tests/unit/auditLog.test.tsx - data visibility and expandable rows - tests/unit/setup.ts - added @testing-library/jest-dom matchers **CI Fix:** - Removed platform label from ARM64 build step (native agent, old Docker) **Test Results:** - Frontend: 38/38 passing ✅ - Backend: 64/64 passing ✅ - TypeScript: no errors ✅ Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
55 lines
1.7 KiB
TypeScript
55 lines
1.7 KiB
TypeScript
import { describe, it, expect, vi } from "vitest";
|
|
import { render, screen, fireEvent } from "@testing-library/react";
|
|
import { DocEditor } from "@/components/DocEditor";
|
|
|
|
describe("DocEditor Component", () => {
|
|
it("renders export buttons with readable text", () => {
|
|
const mockOnChange = vi.fn();
|
|
const mockOnExport = vi.fn();
|
|
|
|
render(
|
|
<DocEditor
|
|
content="# Test Content"
|
|
onChange={mockOnChange}
|
|
onExport={mockOnExport}
|
|
/>
|
|
);
|
|
|
|
const mdButton = screen.getByRole("button", { name: /MD/i });
|
|
const pdfButton = screen.getByRole("button", { name: /PDF/i });
|
|
const docxButton = screen.getByRole("button", { name: /DOCX/i });
|
|
|
|
expect(mdButton).toBeInTheDocument();
|
|
expect(pdfButton).toBeInTheDocument();
|
|
expect(docxButton).toBeInTheDocument();
|
|
|
|
// Buttons should have proper variant for visibility
|
|
expect(mdButton.className).toContain("outline");
|
|
expect(pdfButton.className).toContain("outline");
|
|
expect(docxButton.className).toContain("outline");
|
|
});
|
|
|
|
it("preview mode shows readable text", () => {
|
|
const mockOnChange = vi.fn();
|
|
|
|
render(
|
|
<DocEditor
|
|
content="# Test Heading\n\nTest content"
|
|
onChange={mockOnChange}
|
|
/>
|
|
);
|
|
|
|
// Switch to preview mode
|
|
const previewButton = screen.getByRole("button", { name: /Preview/i });
|
|
fireEvent.click(previewButton);
|
|
|
|
// Preview container should have prose classes for proper contrast
|
|
const previewContainers = document.querySelectorAll(".prose");
|
|
expect(previewContainers.length).toBeGreaterThan(0);
|
|
|
|
const mainContainer = previewContainers[0];
|
|
expect(mainContainer.className).toContain("text-foreground");
|
|
expect(mainContainer.className).toContain("dark:prose-invert");
|
|
});
|
|
});
|