Commit 0803312d authored by webchick's avatar webchick

Issue #2348783 by larowlan, Cottser, kugta | skein: Fixed drupal_set_message...

Issue #2348783 by larowlan, Cottser, kugta | skein: Fixed drupal_set_message inherits previous style if set to 'status'.
parent cf58c1f9
<?php
/**
* @file
* Contains \Drupal\system\Tests\Theme\MessageTest.
*/
namespace Drupal\system\Tests\Theme;
use Drupal\simpletest\KernelTestBase;
/**
* Tests built-in message theme functions.
*
* @group Theme
*/
class MessageTest extends KernelTestBase {
/**
* {@inheritdoc}
*/
public static $modules = array('system');
/**
* Tests setting messages output.
*/
function testMessages() {
drupal_set_message('An error occurred', 'error');
drupal_set_message('But then something nice happened');
$messages = array(
'#theme' => 'status_messages',
);
$this->render($messages);
$this->assertRaw('messages messages--error');
$this->assertRaw('messages messages--status');
}
}
......@@ -17,6 +17,8 @@
* - status_headings: List of all status types.
* - display: (optional) May have a value of 'status' or 'error' when only
* displaying messages of that specific type.
* - attributes: HTML attributes for the element, including:
* - class: HTML classes.
*
* @see template_preprocess_status_messages()
*
......@@ -50,4 +52,6 @@
</div>
{% endif %}
</div>
{# Remove type specific classes. #}
{{ attributes.removeClass(classes) }}
{% endfor %}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment