Mail: inline rand om de card en Outlook-selectors voor dark mode (media-query blijft, licht ongewijzigd)

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-09 20:59:11 +01:00
co-authored by Claude Sonnet 5.5
parent 85d0f6a1b1
commit b8f6b25121
2 changed files with 25 additions and 2 deletions
@@ -269,6 +269,24 @@ public class MailTemplateRendererTests
html.Should().Contain("class=\"mail-logo-light\" src=\"https://t.nl/admin/brand-logo-on-light.png\" alt=\"Andrea Slop Fotografie\" height=\"56\"");
}
[Fact]
public void TheCard_HasAnInlineBorder_ThatSurvivesClientsThatStripTheStyleBlock_AndOutlookHasItsOwnRules()
{
var html = _renderer.Render(MailKind.Invitation, "nl", Model()).Html;
// inline, so it also exists where <style> is removed (Gmail app on non-Gmail accounts) and a client's own
// dark conversion still leaves an edge between card and page
html.Should().MatchRegex("class=\"mail-card\"[^>]*border:1px solid #d1d5db;border-collapse:separate;");
// Outlook.com / Outlook apps mark their dark mode with data-ogsb / data-ogsc, outside the media query
html.Should().Contain($"[data-ogsb] .mail-page{{background-color:{MailTemplateRenderer.DarkPage} !important;}}")
.And.Contain($"[data-ogsb] .mail-card{{background-color:{MailTemplateRenderer.DarkCard} !important;")
.And.Contain("[data-ogsc] .mail-card{color:#f3f4f6 !important;}");
// the media query stays for the clients that do support it
html.Should().Contain("@media (prefers-color-scheme: dark)");
// light mode colours are untouched
html.Should().Contain("bgcolor=\"#f3f4f6\"").And.Contain("bgcolor=\"#ffffff\"");
}
[Fact]
public void WithALogo_TheSiteNameStandsNextToIt_InTheAccentColour()
{