From 6aa8a480841dceba9108e4628c7d2d9b60c04143 Mon Sep 17 00:00:00 2001 From: Andreas Reinhold / reini Date: Mon, 14 Sep 2026 05:40:35 +0200 Subject: [PATCH] Hold the mail theme to the standard contrast level MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit A mail client resolves no attribute, so the JSON's top level — the standard roles — is what it wears, whatever levels the file carries beside them. Plan: docs/plans/material-3-alignment.md, step 7 (core C2). Co-Authored-By: Claude Fable 5.1 Claude-Session: https://claude.ai/code/session_01Qwx5USif3wFFmxtHg5U1g9 --- tests/Feature/MailThemeTest.php | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/tests/Feature/MailThemeTest.php b/tests/Feature/MailThemeTest.php index f7641a50..cc4dca63 100644 --- a/tests/Feature/MailThemeTest.php +++ b/tests/Feature/MailThemeTest.php @@ -86,6 +86,23 @@ function withPackageMailComponents(): void app()->forgetInstance(Markdown::class); } +it('stays on the standard contrast level, which is the one a mail client can show', function () { + File::put($this->temporary.'/material-scheme.json', json_encode([ + 'light' => ['primary' => '#123456', 'on-primary' => '#fefefe', 'surface-container' => '#eeeeee', 'surface-container-lowest' => '#fdfdfd'], + 'dark' => ['primary' => '#abcdef'], + 'contrast' => [ + 'standard' => 0, + 'high' => ['light' => ['primary' => '#000000', 'on-primary' => '#ffffff'], 'dark' => ['primary' => '#ffffff']], + ], + ])); + + config(['livewire-material.scheme' => $this->temporary.'/material-scheme.json']); + + expect(inlineStyle((new ThemedProbeMail)->render(), 'button-primary')) + ->toContain('background-color: #123456') + ->not->toContain('background-color: #000000'); +}); + it('inlines the application\'s scheme onto the mail', function () { File::put($this->temporary.'/material-scheme.json', json_encode([ 'light' => ['primary' => '#123456', 'on-primary' => '#fefefe', 'surface-container' => '#eeeeee', 'surface-container-lowest' => '#fdfdfd'],