|
|
|
@ -5,6 +5,7 @@ import path from "path"; |
|
|
|
import { FixToTheEnd } from "@/components/Componentes/fix-to-the-end"; |
|
|
|
import { PageHeader } from "@/components/Componentes/page-header"; |
|
|
|
import StickyHeader from "@/components/Componentes/sticky-header"; |
|
|
|
import { PageBackground } from "@/components/Componentes/page-background"; |
|
|
|
import { I18nProvider } from "@/translations/provider"; |
|
|
|
|
|
|
|
afterEach(() => { |
|
|
|
@ -120,4 +121,70 @@ describe("Dimensions & Padding Integrity Verification", () => { |
|
|
|
expect(mainMatches).not.toBeNull(); |
|
|
|
expect(mainMatches!.length).toBeGreaterThanOrEqual(4); |
|
|
|
}); |
|
|
|
|
|
|
|
it("globals.css defines #F5F5F5 for page-background-none and #F7F1F0 for page-background-cream", () => { |
|
|
|
const cssPath = path.resolve(process.cwd(), "src/app/globals.css"); |
|
|
|
const cssContent = fs.readFileSync(cssPath, "utf-8"); |
|
|
|
|
|
|
|
// page-background-none sets #F5F5F5
|
|
|
|
expect(cssContent).toMatch( |
|
|
|
/body:has\(\.page-background-none\),\s*html:has\(\.page-background-none\)\s*\{[\s\S]*?background-color:\s*#F5F5F5\s*!important;/, |
|
|
|
); |
|
|
|
|
|
|
|
// page-background-cream sets #F7F1F0
|
|
|
|
expect(cssContent).toMatch( |
|
|
|
/body:has\(\.page-background-cream\),\s*html:has\(\.page-background-cream\)\s*\{[\s\S]*?background-color:\s*#F7F1F0\s*!important;/, |
|
|
|
); |
|
|
|
|
|
|
|
// section-overlay uses #F7F1F0 without background-image
|
|
|
|
expect(cssContent).toMatch( |
|
|
|
/\.section-overlay\s*\{[\s\S]*?background-color:\s*#F7F1F0;[\s\S]*?background-image:\s*none;/, |
|
|
|
); |
|
|
|
|
|
|
|
// questions-list-main and questions-list-header exist
|
|
|
|
expect(cssContent).toMatch( |
|
|
|
/\.questions-list-main\s*\{[\s\S]*?margin-inline:\s*calc\(-1\s*\*\s*var\(--app-shell-px,\s*17px\)\);/, |
|
|
|
); |
|
|
|
expect(cssContent).toMatch( |
|
|
|
/\.questions-list-header\s*\{[\s\S]*?margin-inline:\s*calc\(-1\s*\*\s*var\(--app-shell-px,\s*17px\)\);/, |
|
|
|
); |
|
|
|
}); |
|
|
|
|
|
|
|
it("questions-list-client uses questions-list-main and questions-list-header without hardcoded -mx-[17px]", () => { |
|
|
|
const listClientPath = path.resolve( |
|
|
|
process.cwd(), |
|
|
|
"src/app/questions-list/questions-list-client.tsx", |
|
|
|
); |
|
|
|
const content = fs.readFileSync(listClientPath, "utf-8"); |
|
|
|
|
|
|
|
expect(content).not.toMatch(/<main[^>]*className="[^"]*-mx-\[17px\]/); |
|
|
|
expect(content).not.toMatch(/<header[^>]*className="[^"]*-mx-\[17px\]/); |
|
|
|
|
|
|
|
const mainMatches = content.match( |
|
|
|
/<main[^>]*className="[^"]*questions-list-main/g, |
|
|
|
); |
|
|
|
expect(mainMatches).not.toBeNull(); |
|
|
|
expect(mainMatches!.length).toBe(3); |
|
|
|
|
|
|
|
const headerMatches = content.match( |
|
|
|
/<header[^>]*className="[^"]*questions-list-header/g, |
|
|
|
); |
|
|
|
expect(headerMatches).not.toBeNull(); |
|
|
|
expect(headerMatches!.length).toBe(3); |
|
|
|
}); |
|
|
|
|
|
|
|
it("PageBackground handles disabled, variant cream and default correctly", () => { |
|
|
|
const { container: c1 } = render(<PageBackground disabled />); |
|
|
|
expect(c1.querySelector(".page-background-none")).toBeInTheDocument(); |
|
|
|
expect(c1.querySelector(".page-background-cream")).not.toBeInTheDocument(); |
|
|
|
|
|
|
|
const { container: c2 } = render( |
|
|
|
<PageBackground disabled variant="cream" />, |
|
|
|
); |
|
|
|
expect(c2.querySelector(".page-background-none")).toBeInTheDocument(); |
|
|
|
expect(c2.querySelector(".page-background-cream")).toBeInTheDocument(); |
|
|
|
|
|
|
|
const { container: c3 } = render(<PageBackground />); |
|
|
|
expect(c3.querySelector(".page-background-default")).toBeInTheDocument(); |
|
|
|
}); |
|
|
|
}); |