Hi there,

when I have a status message following a warning message, the status message has also the warning class in it.
I think the problem is the attributes variable in the status-messages.html.twig which is not somehow reset for every loop in the for statement.

{% for type, messages in message_list %}
  {%
    set classes = [
      'messages',
      'messages--' ~ type,
    ]
  %}
  <div class="{{ attributes.addClass(classes).class }}" role="contentinfo" aria-label="{{ status_headings[type] }}">
    {% if type == 'error' %}
      <div role="alert">
    {% endif %}
      {% if status_headings[type] %}
        <h2 class="visually-hidden">{{ status_headings[type] }}</h2>
      {% endif %}

any ideas? where are the twig specialists?! :-)

greetings ifux

Files: 
CommentFileSizeAuthor
#5 wrong_classes_on_status-2345005-5.patch2.19 KBlegolasbo
FAILED: [[SimpleTest]]: [PHP 5.4 MySQL] 79,026 pass(es), 23 fail(s), and 0 exception(s). View
Bildschirmfoto 2014-09-25 um 18.53.55.png82.42 KBifux

Comments

tim.plunkett’s picture

Issue tags: +Twig

No idea why this is done in twig. This would be much easier in PHP. I have no idea how to reset attributes in each loop.

damiankloip’s picture

tim.plunkett’s picture

Issue tags: +Needs tests
legolasbo’s picture

I'll write some tests for this issue.

legolasbo’s picture

Status: Active » Needs review
Issue tags: -Needs tests
FileSize
2.19 KB
FAILED: [[SimpleTest]]: [PHP 5.4 MySQL] 79,026 pass(es), 23 fail(s), and 0 exception(s). View

Attached patch adds tests for this issue, which will obviously fail since there is no patch yet.

Status: Needs review » Needs work

The last submitted patch, 5: wrong_classes_on_status-2345005-5.patch, failed testing.

lauriii’s picture

Assigned: Unassigned » lauriii
lauriii’s picture

Assigned: lauriii » Unassigned
Status: Needs work » Closed (duplicate)