Skip to content

Commit

Permalink
EWPP-4689: Fix default variant of navigation_menu to use button inste…
Browse files Browse the repository at this point in the history
…ad of link for openning the menu.
  • Loading branch information
22Alexandra authored and upchuk committed Aug 28, 2024
1 parent 4cef5aa commit 9b792ae
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -63,10 +63,7 @@
{% include '@ecl-twig/menu' with {
title: label|default('Menu'|t),
toggle: {
link: {
label: label|default('Menu'|t),
hide_label: true
},
label: label|default('Menu'|t),
icon: {
path: ecl_icon_path,
name: 'hamburger',
Expand Down
4 changes: 2 additions & 2 deletions tests/src/Functional/SiteHeaderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -246,9 +246,9 @@ public function testSiteHeader(): void {

// Assert the menu container.
$menu_container = $assert->elementExists('css', 'nav div.ecl-container.ecl-menu__container', $main_menu);
$this->assertStringContainsString('Menu', $menu_container->find('css', "a.ecl-link.ecl-link--standalone.ecl-menu__open[href][data-ecl-menu-open] span.ecl-link__label")
$this->assertStringContainsString('Menu', $menu_container->find('css', "button.ecl-button--tertiary.ecl-menu__open.ecl-button--icon-only[data-ecl-menu-open] span.ecl-button__label")
->getText());
$icon = $menu_container->find('css', "a.ecl-menu__open svg.ecl-icon.ecl-icon--m[focusable='false'][aria-hidden='true']");
$icon = $menu_container->find('css', "button.ecl-menu__open svg.ecl-icon.ecl-icon--m[focusable='false'][aria-hidden='true']");
$this->assertEquals('<use xlink:href="/build/themes/custom/oe_theme/dist/' . $component . '/images/icons/sprites/icons.svg#hamburger" xmlns:xlink="http://www.w3.org/1999/xlink"></use>', $icon->getHtml());
$assert->elementExists('css', "section.ecl-menu__inner[data-ecl-menu-inner]", $menu_container);
$assert->elementExists('css', 'section header.ecl-menu__inner-header', $menu_container);
Expand Down
6 changes: 3 additions & 3 deletions tests/src/Kernel/fixtures/rendering.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3433,9 +3433,9 @@
"li.ecl-menu__item:nth-child(1) button[aria-label=\"Access item's children\"]": 1
"li.ecl-menu__item:nth-child(2) button[aria-label=\"Access item's children\"]": 1
"div.ecl-container.ecl-menu__container section.ecl-menu__inner[data-ecl-menu-inner]": 1
"a.ecl-link--standalone.ecl-button.ecl-button--tertiary.ecl-menu__open.ecl-link--icon-only": 1
"button.ecl-button--tertiary.ecl-menu__open.ecl-button--icon-only": 1
equals:
'a.ecl-menu__open.ecl-link--icon-only span.ecl-link__label': 'Menu'
'button.ecl-menu__open.ecl-button--icon-only span.ecl-button__label': 'Menu'
'.ecl-menu__inner-header button.ecl-menu__close[data-ecl-menu-close] span.ecl-button__label': "Close"
'.ecl-menu__inner-header button.ecl-menu__back[data-ecl-menu-back] .ecl-button__label': "Back"
'li.ecl-menu__item.ecl-menu__item--has-children:nth-child(1) a.ecl-menu__link': "Parent 1"
Expand Down Expand Up @@ -3485,7 +3485,7 @@
"nav.ecl-menu[data-ecl-menu][data-ecl-menu-max-lines=\"3\"][data-ecl-auto-init=\"Menu\"][aria-expanded=\"false\"][role=\"navigation\"][aria-label=\"Site navigation\"]": 1
"li.ecl-menu__item:nth-child(1) button[aria-label=\"Access item's children\"]": 1
equals:
'.ecl-menu__open .ecl-link__label': "Custom Menu"
'button.ecl-menu__open span.ecl-button__label': "Custom Menu"
'.ecl-menu__inner-header button.ecl-menu__close[data-ecl-menu-close] span.ecl-button__label': "Close"
'.ecl-menu__inner-header button.ecl-menu__back[data-ecl-menu-back] .ecl-button__label': "Back"
'li.ecl-menu__item:nth-child(1) a.ecl-menu__link': "Parent 1"
Expand Down

0 comments on commit 9b792ae

Please sign in to comment.