feat(cv): extend templates and extraction
This commit is contained in:
@@ -210,6 +210,21 @@ public sealed class CvBuilderTests
|
||||
Assert.DoesNotContain("transform:scale", html);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Multi_entry_sections_flow_between_entries_instead_of_leaving_a_blank_page()
|
||||
{
|
||||
var profile = Rich();
|
||||
profile.Jobs.Add(new StructuredCvJob { Id = "job3", Title = "Engineer III", Company = "Example", Bullets = { "Shipped reliable services." } });
|
||||
|
||||
var settings = new CvVariantSettings { ThemeId = "code" };
|
||||
var model = CvVariantResolver.Build(profile, settings, "F", null);
|
||||
var html = new ThemedCvRenderer().Render(model, CvThemeCatalog.Resolve("code"), settings).Html;
|
||||
|
||||
Assert.Contains("section section-experience section-flow", html);
|
||||
Assert.Contains(".section-flow{break-inside:auto", html);
|
||||
Assert.DoesNotContain(":has(", html);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Header_band_and_sidebar_contact_text_own_their_contrasting_palette()
|
||||
{
|
||||
@@ -217,12 +232,11 @@ public sealed class CvBuilderTests
|
||||
var model = CvVariantResolver.Build(Rich(), new CvVariantSettings(), "F", null);
|
||||
var modern = renderer.Render(model, CvThemeCatalog.Resolve("modern"), new CvVariantSettings { ThemeId = "modern" }).Html;
|
||||
var lightAccent = renderer.Render(model, CvThemeCatalog.Resolve("modern"), new CvVariantSettings { ThemeId = "modern", AccentColor = "#f8fafc" }).Html;
|
||||
var technicalTheme = CvThemeCatalog.Resolve("technical");
|
||||
var technical = renderer.Render(model, technicalTheme, new CvVariantSettings { ThemeId = "technical" }).Html;
|
||||
var technical = renderer.Render(model, CvThemeCatalog.Resolve("technical"), new CvVariantSettings { ThemeId = "technical" }).Html;
|
||||
|
||||
Assert.Contains(".header-band .name,.header-band .headline,.header-band .contact,.header-band .contact-item,.header-band a{color:#fff;}", modern);
|
||||
Assert.Contains(".header-band .name,.header-band .headline,.header-band .contact,.header-band .contact-item,.header-band a{color:#000;}", lightAccent);
|
||||
Assert.Contains($".sidebar .contact,.sidebar .headline,.sidebar .entry-meta,.sidebar .entry-subtitle{{color:{technicalTheme.SidebarInk};}}", technical);
|
||||
Assert.Contains(".sidebar .contact,.sidebar .headline,.sidebar .entry-meta,.sidebar .entry-subtitle{color:var(--cv-accent-ink);}", technical);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -272,8 +286,8 @@ public sealed class CvBuilderTests
|
||||
|
||||
Assert.Equal(13, settings.BaseFontSizePt);
|
||||
Assert.Contains("grid-template-columns:minmax(0,1fr) 70mm", html);
|
||||
Assert.Contains("color:#123456", html);
|
||||
Assert.Contains("background:#fafafa", html);
|
||||
Assert.Contains("--cv-ink:#123456", html);
|
||||
Assert.Contains("--cv-paper:#fafafa", html);
|
||||
Assert.Contains("line-height:1.55", html);
|
||||
Assert.Contains("font-size:13pt", html);
|
||||
Assert.Contains("class=\"skills-text\">C# · SQL</p>", html);
|
||||
@@ -437,12 +451,44 @@ public sealed class CvBuilderTests
|
||||
Assert.Equal("user-1", await svc.GetPublicOwnerAsync(v.PublicSlug, default));
|
||||
}
|
||||
[Fact]
|
||||
public void Premium_theme_policy_keeps_three_free_themes_available()
|
||||
public void Premium_theme_policy_keeps_free_themes_available()
|
||||
{
|
||||
Assert.Equal(3, CvThemeCatalog.Themes.Count(t => CvThemeCatalog.CanUse(t.Id, false)));
|
||||
Assert.Equal(4, CvThemeCatalog.Themes.Count(t => CvThemeCatalog.CanUse(t.Id, false)));
|
||||
Assert.Equal(5, CvThemeCatalog.Themes.Count(t => t.Premium));
|
||||
Assert.All(CvThemeCatalog.Themes, t => Assert.True(CvThemeCatalog.CanUse(t.Id, true)));
|
||||
Assert.False(CvThemeCatalog.CanUse("unknown", true));
|
||||
}
|
||||
|
||||
|
||||
[Fact]
|
||||
public void Code_theme_uses_registry_driven_numbered_sections_and_shared_accent_tokens()
|
||||
{
|
||||
var settings = new CvVariantSettings { ThemeId = "code", AccentColor = "#126b55" };
|
||||
var model = CvVariantResolver.Build(Rich(), settings, "F", null);
|
||||
var html = new ThemedCvRenderer().Render(model, CvThemeCatalog.Resolve("code"), settings).Html;
|
||||
|
||||
Assert.Contains("counter-reset:cv-section", html);
|
||||
Assert.Contains("--cv-accent-color:#126b55", html);
|
||||
Assert.Contains("Consolas", html);
|
||||
Assert.True(CvThemeCatalog.Resolve("code").AtsFriendly);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Section_overrides_skill_groups_and_custom_paragraphs_share_the_render_model()
|
||||
{
|
||||
var settings = new CvVariantSettings
|
||||
{
|
||||
Sections = { new CvSectionSetting { Key = "summary", Items = new() { "Tailored summary" } } },
|
||||
SkillsStyle = "grouped",
|
||||
SkillGroups = new() { new CvSkillGroupSetting { Name = "Backend", Items = { "C#", ".NET" } } },
|
||||
CustomSections = { new CvCustomSectionSetting { Key = "decl", Title = "Declaration", ContentType = "paragraphs", Items = { "I confirm these details." } } },
|
||||
};
|
||||
var model = CvVariantResolver.Build(Rich(), settings, "F", null);
|
||||
var html = new ThemedCvRenderer().Render(model, CvThemeCatalog.Resolve("modern"), settings).Html;
|
||||
|
||||
Assert.Equal(new[] { "Tailored summary" }, model.Sections.Single(section => section.Key == "summary").Bullets);
|
||||
Assert.Contains("class=\"skill-group-name\">Backend", html);
|
||||
Assert.Contains("class=\"paragraphs\"><p>I confirm these details.</p>", html);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user