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 0000000000000000000000000000000000000000..e5034471b397a22bf63e590391ebb6d42ed94b57 --- /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 0000000000000000000000000000000000000000..ef5a5489682323e2e20e94e50c1783ac5535756f --- /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 0000000000000000000000000000000000000000..e7088048d028879f59215c454799178ba0a9368d --- /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 b8d4252d664ed9dcaa3667061be6899afccfe755..e6dacf27ec453010140b4fc38814ffd07fb98abb 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;">'); + } + }