diff --git a/core/modules/block/src/Tests/Views/DisplayBlockTest.php b/core/modules/block/src/Tests/Views/DisplayBlockTest.php index 7f3665a..dfb133e 100644 --- a/core/modules/block/src/Tests/Views/DisplayBlockTest.php +++ b/core/modules/block/src/Tests/Views/DisplayBlockTest.php @@ -288,8 +288,13 @@ public function testBlockContextualLinks() { $response = $this->drupalPost('contextual/render', 'application/json', $post, array('query' => array('destination' => 'test-page'))); $this->assertResponse(200); $json = Json::decode($response); - $this->assertIdentical($json[$id], ''); - $this->assertIdentical($json[$cached_id], ''); + $this->setRawContent($json[$id]); + $result = $this->xpath('//ul/li/a[contains(@href, :block) and text()="Configure block"]', [':block' => "admin/structure/block/manage/" . $block->id()]); + $this->assertTrue($result, 'The contextual links are present.'); + $this->setRawContent($json[$cached_id]); + $result = $this->xpath('//ul/li/a[contains(@href, :cached_block) and text()="Configure block"]', [':cached_block' => "admin/structure/block/manage/" . $cached_block->id()]); + $this->assertTrue($result, 'The contextual links are present.'); + } } diff --git a/core/modules/system/templates/links.html.twig b/core/modules/system/templates/links.html.twig index 21ab95d..479f0dd 100644 --- a/core/modules/system/templates/links.html.twig +++ b/core/modules/system/templates/links.html.twig @@ -36,25 +36,25 @@ * @ingroup themeable */ #} -{% if links -%} - {%- if heading -%} - {%- if heading.level -%} +{% if links %} + {% if heading %} + {% if heading.level %} <{{ heading.level }}{{ heading.attributes }}>{{ heading.text }} - {%- else -%} + {% else %} {{ heading.text }} - {%- endif -%} - {%- endif -%} + {% endif %} + {% endif %} - {%- for key, item in links -%} + {% for key, item in links %} - {%- if item.link -%} + {% if item.link %} {{ item.link }} - {%- elseif item.text_attributes -%} + {% elseif item.text_attributes %} {{ item.text }} - {%- else -%} + {% else %} {{ item.text }} - {%- endif -%} + {% endif %} - {%- endfor -%} + {% endfor %} -{%- endif %} +{% endif %} diff --git a/core/themes/classy/templates/navigation/links.html.twig b/core/themes/classy/templates/navigation/links.html.twig index 5f62ac3..1d91953 100644 --- a/core/themes/classy/templates/navigation/links.html.twig +++ b/core/themes/classy/templates/navigation/links.html.twig @@ -34,25 +34,25 @@ * @see template_preprocess_links() */ #} -{% if links -%} - {%- if heading -%} - {%- if heading.level -%} +{% if links %} + {% if heading %} + {% if heading.level %} <{{ heading.level }}{{ heading.attributes }}>{{ heading.text }} - {%- else -%} + {% else %} {{ heading.text }} - {%- endif -%} - {%- endif -%} + {% endif %} + {% endif %} - {%- for key, item in links -%} + {% for key, item in links %} - {%- if item.link -%} + {% if item.link %} {{ item.link }} - {%- elseif item.text_attributes -%} + {% elseif item.text_attributes %} {{ item.text }} - {%- else -%} + {% else %} {{ item.text }} - {%- endif -%} + {% endif %} - {%- endfor -%} + {% endfor %} -{%- endif %} +{% endif %}