fix(cv): restore distinct responsive templates
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { getCvPageCount, getCvPageMetrics, moveItem, normalizeCvLanguage, wrapSelection } from "./cvBuilder";
|
||||
import { applyCvTheme, getCvPageCount, getCvPageMetrics, getCvPreviewFitZoom, moveItem, normalizeCvLanguage, wrapSelection } from "./cvBuilder";
|
||||
|
||||
describe("moveItem", () => {
|
||||
test("moves an item forward", () => {
|
||||
@@ -59,4 +59,41 @@ describe("CV language compatibility", () => {
|
||||
expect(normalizeCvLanguage("nb-NO")).toBe("nb-NO");
|
||||
expect(normalizeCvLanguage("en")).toBe("en");
|
||||
});
|
||||
|
||||
test("fits the physical page to the available preview width", () => {
|
||||
expect(getCvPreviewFitZoom(500, 800)).toBeCloseTo(0.595);
|
||||
expect(getCvPreviewFitZoom(1200, 800)).toBe(1);
|
||||
expect(getCvPreviewFitZoom(120, 800)).toBe(0.32);
|
||||
});
|
||||
});
|
||||
|
||||
describe("CV template selection", () => {
|
||||
test("restores the selected template structure without discarding user content or design choices", () => {
|
||||
const settings = {
|
||||
themeId: "minimal",
|
||||
layout: "single" as const,
|
||||
headerStyle: "plain" as const,
|
||||
headingStyle: "plain" as const,
|
||||
sidebarWidthMm: 70,
|
||||
sidebarSections: ["skills"],
|
||||
accentColor: "#123456",
|
||||
showPhoto: false,
|
||||
showPageNumbers: false,
|
||||
showIcons: true,
|
||||
sections: [{ key: "experience", title: "Career" }],
|
||||
overrides: {},
|
||||
customSections: [],
|
||||
};
|
||||
|
||||
expect(applyCvTheme(settings, "technical")).toMatchObject({
|
||||
themeId: "technical",
|
||||
layout: null,
|
||||
headerStyle: null,
|
||||
headingStyle: null,
|
||||
sidebarWidthMm: null,
|
||||
sidebarSections: null,
|
||||
accentColor: "#123456",
|
||||
sections: [{ key: "experience", title: "Career" }],
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user