From e391a19f65d3f3d5a35817a915dc3fae803e92b2 Mon Sep 17 00:00:00 2001 From: Mingsong <2151-AMDS@users.noreply.drupalcode.org> Date: Sat, 16 Sep 2023 13:49:42 +0100 Subject: [PATCH] Issue #3371042 by Niklan, Mingsong, AdamPS: Drupal 10.1.0 new aggregation breaks InlineCssEmailAdjuster (tests only) --- .../symfony_mailer_test/css/inline.day.css | 3 +++ .../symfony_mailer_test/css/inline.text-small.css | 5 +++++ .../symfony_mailer_test.libraries.yml | 4 ++++ tests/src/Kernel/SymfonyMailerKernelTest.php | 15 +++++++++++++++ 4 files changed, 27 insertions(+) create mode 100644 tests/modules/symfony_mailer_test/css/inline.day.css create mode 100644 tests/modules/symfony_mailer_test/css/inline.text-small.css create mode 100644 tests/modules/symfony_mailer_test/symfony_mailer_test.libraries.yml diff --git a/tests/modules/symfony_mailer_test/css/inline.day.css b/tests/modules/symfony_mailer_test/css/inline.day.css new file mode 100644 index 00000000..e5034471 --- /dev/null +++ b/tests/modules/symfony_mailer_test/css/inline.day.css @@ -0,0 +1,3 @@ +span.day { + font-style: italic; +} diff --git a/tests/modules/symfony_mailer_test/css/inline.text-small.css b/tests/modules/symfony_mailer_test/css/inline.text-small.css new file mode 100644 index 00000000..ef5a5489 --- /dev/null +++ b/tests/modules/symfony_mailer_test/css/inline.text-small.css @@ -0,0 +1,5 @@ +@import url('inline.day.css'); + +h4.text-small { + font-weight: bold; +} diff --git a/tests/modules/symfony_mailer_test/symfony_mailer_test.libraries.yml b/tests/modules/symfony_mailer_test/symfony_mailer_test.libraries.yml new file mode 100644 index 00000000..e7088048 --- /dev/null +++ b/tests/modules/symfony_mailer_test/symfony_mailer_test.libraries.yml @@ -0,0 +1,4 @@ +inline_css_test: + css: + theme: + css/inline.text-small.css: {} diff --git a/tests/src/Kernel/SymfonyMailerKernelTest.php b/tests/src/Kernel/SymfonyMailerKernelTest.php index b8d4252d..e6dacf27 100644 --- a/tests/src/Kernel/SymfonyMailerKernelTest.php +++ b/tests/src/Kernel/SymfonyMailerKernelTest.php @@ -60,4 +60,19 @@ class SymfonyMailerKernelTest extends KernelTestBase { $this->assertTo($to); } + /** + * Inline CSS adjuster test. + */ + public function testInlineCss() { + $to = 'to@example.com'; + // Test an email including the test library. + $this->emailFactory->newTypedEmail('symfony_mailer', 'test', $to)->addLibrary('symfony_mailer_test/inline_css_test')->send(); + $this->readMail(); + $this->assertNoError(); + // The inline CSS from inline.text-small.css should appear. + $this->assertBodyContains('<h4 class="text-small" style="padding-top: 3px; padding-bottom: 3px; text-align: center; background-color: #0678be; color: white; font-size: smaller; font-weight: bold;">'); + // The imported CSS from inline.day.css should appear. + $this->assertBodyContains('<span class="day" style="font-style: italic;">'); + } + } -- GitLab