feat(cv): qualify templates and reliable local import processing
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { applyCvTheme, getCvPageCount, getCvPageMetrics, getCvPreviewFitZoom, getVisibleCvThemes, moveItem, normalizeCvLanguage, wrapSelection } from "./cvBuilder";
|
||||
import { applyCvTheme, emptyCvVariantSettings, newCvVariantSettings, getCvPageCount, getCvPageMetrics, getCvPreviewFitZoom, getVisibleCvThemes, moveItem, normalizeCvLanguage, wrapSelection } from "./cvBuilder";
|
||||
|
||||
describe("moveItem", () => {
|
||||
test("moves an item forward", () => {
|
||||
@@ -68,6 +68,22 @@ describe("CV language compatibility", () => {
|
||||
});
|
||||
|
||||
describe("CV template selection", () => {
|
||||
test("new documents opt into revised design while legacy fixture defaults stay unchanged", () => {
|
||||
expect(newCvVariantSettings("nordic")).toEqual({ ...emptyCvVariantSettings("nordic"), designVersion: 2 });
|
||||
expect(emptyCvVariantSettings()).not.toHaveProperty("designVersion");
|
||||
});
|
||||
test("explicit template Apply opts into revised design and preserves inclusion and authored content", () => {
|
||||
const legacy = {
|
||||
themeId: "modern", showPhoto: true, showPageNumbers: false, showIcons: true,
|
||||
designVersion: 1, sectionsExplicit: true, includeProfileContact: false,
|
||||
headline: "Authored headline", sections: [{ key: "summary", items: ["Authored summary"] }], overrides: {}, customSections: [],
|
||||
};
|
||||
const next = applyCvTheme(legacy, "technical");
|
||||
expect(next).toMatchObject({ designVersion: 2, themeId: "technical", sectionsExplicit: true, includeProfileContact: false,
|
||||
headline: "Authored headline", sections: legacy.sections, showPhoto: true });
|
||||
expect(legacy.designVersion).toBe(1);
|
||||
});
|
||||
|
||||
test("restores the selected template visual defaults without discarding user content", () => {
|
||||
const settings = {
|
||||
themeId: "minimal",
|
||||
|
||||
Reference in New Issue
Block a user