Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
name: Breadcrumb
status: experimental
props:
type: object
properties:
breadcrumb:
type: array
title: Breadcrumb items
17 changes: 17 additions & 0 deletions themes/custom/az_barrio/components/breadcrumb/breadcrumb.twig
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{% if breadcrumb %}
<nav role="navigation" aria-label="breadcrumb">
<ol class="breadcrumb">
{% for item in breadcrumb %}
{% if item.url %}
<li class="{{ item.classes }}">
<a href="{{ item.url }}">{{ item.text }}</a>
</li>
{% else %}
<li class="{{ item.classes }}" aria-current="page">
{{ item.text }}
</li>
{% endif %}
{% endfor %}
</ol>
</nav>
{% endif %}
Original file line number Diff line number Diff line change
Expand Up @@ -8,20 +8,6 @@
*/
#}

{% if breadcrumb %}
<nav role="navigation" aria-label="breadcrumb">
<ol class="breadcrumb">
{% for item in breadcrumb %}
{% if item.url %}
<li class="{{ item.classes }}">
<a href="{{ item.url }}">{{ item.text }}</a>
</li>
{% else %}
<li class="{{ item.classes }}" aria-current="page">
{{ item.text }}
</li>
{% endif %}
{% endfor %}
</ol>
</nav>
{% endif %}
{{ include('az_barrio:breadcrumb', {
breadcrumb: breadcrumb,
}, with_context = false) }}
10 changes: 10 additions & 0 deletions themes/custom/az_barrio/tests/src/Functional/AzBarrioTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,16 @@ public function testAnonymous() {
$this->assertSession()->elementExists('css', '#navbar-top.navbar.navbar-expand');
$this->assertSession()->elementExists('css', '#block-az-barrio-offcanvas-searchform');
$this->assertSession()->elementExists('css', '#block-az-barrio-mobilenavblock');

// Tests that breadcrumb block visibility and markup remain intact.
$this->drupalGet('');
$this->assertSession()->elementNotExists('css', 'nav[aria-label="breadcrumb"]');

$this->drupalGet('user/login');
$this->assertSession()->elementExists('css', 'nav[aria-label="breadcrumb"]');
$this->assertSession()->elementExists('css', 'nav[aria-label="breadcrumb"] ol.breadcrumb');
$this->assertSession()->elementExists('css', 'nav[aria-label="breadcrumb"] .breadcrumb-item-home a');
$this->assertSession()->elementExists('css', 'nav[aria-label="breadcrumb"] .breadcrumb-item.active[aria-current="page"]');
}

}
Loading