Commit 1939de98 authored by webchick's avatar webchick

Issue #2191323 by Cottser: Item-list.html.twig always shows empty text.

parent eeb7c103
......@@ -60,6 +60,14 @@ function testItemList() {
$expected = '<div class="item-list"><h3>Some title</h3>No items found.</div>';
$this->assertThemeOutput('item_list', $variables, $expected, 'Empty %callback generates empty string with title.');
// Verify that empty text is not displayed when there are list items.
$variables = array();
$variables['title'] = 'Some title';
$variables['empty'] = 'No items found.';
$variables['items'] = array('Un', 'Deux', 'Trois');
$expected = '<div class="item-list"><h3>Some title</h3><ul><li>Un</li><li>Deux</li><li>Trois</li></ul></div>';
$this->assertThemeOutput('item_list', $variables, $expected, '%callback does not print empty text when there are list items.');
// Verify nested item lists.
$variables = array();
$variables['title'] = 'Some title';
......
......@@ -29,7 +29,8 @@
<li{{ item.attributes }}>{{ item.value }}</li>
{%- endfor -%}
</{{ list_type }}>
{%- else -%}
{{- empty -}}
{%- endif -%}
{{- empty -}}
</div>
{%- endif %}
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