commit 7d639cf7ba5167c42ae5a1f58107ac09514bb9a2 Author: Dom Date: Fri Oct 30 01:46:38 2015 +0100 new patch 17 diff --git a/core/tests/Drupal/KernelTests/Core/Common/DrupalSetMessageLoadsCssTest.php b/core/tests/Drupal/KernelTests/Core/Common/DrupalSetMessageLoadsCssTest.php index 587fc68..d3e0f0c 100644 --- a/core/tests/Drupal/KernelTests/Core/Common/DrupalSetMessageLoadsCssTest.php +++ b/core/tests/Drupal/KernelTests/Core/Common/DrupalSetMessageLoadsCssTest.php @@ -28,18 +28,20 @@ public function testDrupalSetMessage() { + // Test with aggregated CSS turned off. + $config = $this->config('system.performance'); + $config->set('css.preprocess', 0); + $config->save(); + // Get the frontpage. $this->drupalGet(""); - // Check that message assets are loaded. - $this->assertRaw("core/themes/classy/css/components/messages.css", "Message CSS assets should be loaded."); + // Check that no message appears. + $this->assertNoRaw("messages--", "No message should be displayed on page."); + // Thus, check that no message asset is loaded uselessly. + $this->assertNoRaw("core/themes/classy/css/components/messages.css", "Message CSS assets should not be loaded when not needed."); // Display a message. - drupal_set_message(t('A message: @foo', ['@foo' => 'bar'])); + drupal_set_message(t('A status message.')); // Get the frontpage. $this->drupalGet(""); // Check that messages are display. - $this->assertRaw("A message:", "The Drupal message should be displayed."); + $this->assertRaw("messages--", "The message should appear on page"); - - // Check that message assets are not loaded. - $this->assertNoRaw("core/themes/classy/css/components/messages.css", "Message CSS assets should not be loaded."); + // Thus, check that message assets are loaded when required. + $this->assertRaw("core/themes/classy/css/components/messages.css", "Message CSS assets should be loaded when needed."); } }