mirror of
https://github.com/AmruthPillai/Reactive-Resume.git
synced 2026-08-24 07:12:18 +10:00
Move 14 identical style slots (text/heading/div/inline/link/small/bold/ richParagraph/richListItemRow/richListItemMarker/richListItemContent/ splitRow/alignEnd/picture) from all 15 template Page.tsx files into a single createBaseTemplateStyles factory in templates/shared. Each template now spreads …base and keeps only its real overrides. Resolved StyleSheet values are identical to before. Update rtl-fixture and rich-text-template- styles tests to guard the factory file rather than each template directly. Claude-Session: https://claude.ai/code/session_012Bnvt1MghwHj4qQRxuQUGa
29 lines
1.1 KiB
TypeScript
29 lines
1.1 KiB
TypeScript
import { readFileSync } from "node:fs";
|
|
import { fileURLToPath } from "node:url";
|
|
import { describe, expect, it } from "vitest";
|
|
import { templateSchema } from "@reactive-resume/schema/templates";
|
|
|
|
const templatePages = templateSchema.options.map(
|
|
(template) =>
|
|
[
|
|
template,
|
|
fileURLToPath(new URL(`./templates/${template}/${capitalize(template)}Page.tsx`, import.meta.url)),
|
|
] as const,
|
|
);
|
|
|
|
function capitalize(template: string): string {
|
|
return template.charAt(0).toUpperCase() + template.slice(1);
|
|
}
|
|
|
|
describe("RTL PDF fixture", () => {
|
|
it.each(templatePages)("%s wires shared RTL helpers and alignEnd slot", (_template, pagePath) => {
|
|
const source = readFileSync(pagePath, "utf8");
|
|
|
|
expect(source).toContain("createRtlStyleHelpers");
|
|
// ponytail: alignEnd moved to createBaseTemplateStyles factory; either direct or factory counts.
|
|
expect(source.includes("alignEnd") || source.includes("createBaseTemplateStyles")).toBe(true);
|
|
expect(source).not.toContain("alignRight");
|
|
expect(source).not.toContain('from "@reactive-resume/utils/locale"');
|
|
});
|
|
});
|