Cover viewing_only_enabled_taxons_in_taxon_menu.feature scenario

This commit is contained in:
TheMilek 2023-05-09 17:02:25 +02:00
parent f3c6463e7a
commit 1f9e9419c0
No known key found for this signature in database
GPG key ID: 2E44205E7374692F
3 changed files with 4 additions and 12 deletions

View file

@ -12,15 +12,7 @@ Feature: Viewing only enabled taxons in taxon menu
And the "Accessories" taxon has children taxons "Caps" and "Belts" And the "Accessories" taxon has children taxons "Caps" and "Belts"
And channel "United States" has menu taxon "Category" And channel "United States" has menu taxon "Category"
@ui @api @ui
Scenario: Viewing only enabled taxons in taxon menu
Given the "Clothes" taxon is disabled
And the "Belts" taxon is disabled
When I check available taxons
Then I should see "Accessories Caps" and "Caps" in the menu
And I should not see "Clothes", "T-Shirts", "Coats" and "Belts" in the menu
@api
Scenario: Viewing only enabled taxons in taxon menu Scenario: Viewing only enabled taxons in taxon menu
Given the "Clothes" taxon is disabled Given the "Clothes" taxon is disabled
And the "Belts" taxon is disabled And the "Belts" taxon is disabled

View file

@ -22,7 +22,7 @@ final class MenuElement extends Element implements MenuElementInterface
{ {
$menu = $this->getElement('menu'); $menu = $this->getElement('menu');
return array_map(fn (NodeElement $element): string => $element->getText(), $menu->findAll('css', '[data-test-menu-item]')); return array_map(fn (NodeElement $element): string => $element->getAttribute('data-test-menu-item'), $menu->findAll('css', '[data-test-menu-item]'));
} }
protected function getDefinedElements(): array protected function getDefinedElements(): array

View file

@ -2,7 +2,7 @@
{% import _self as macros %} {% import _self as macros %}
{% if taxon.enabledChildren|length > 0 %} {% if taxon.enabledChildren|length > 0 %}
<div class="ui dropdown item" {{ sylius_test_html_attribute('menu-item') }}> <div class="ui dropdown item" {{ sylius_test_html_attribute('menu-item', taxon.name) }}>
<span class="text">{{ taxon.name }}</span> <span class="text">{{ taxon.name }}</span>
<i class="dropdown icon"></i> <i class="dropdown icon"></i>
<div class="menu"> <div class="menu">
@ -12,7 +12,7 @@
</div> </div>
</div> </div>
{% else %} {% else %}
<a href="{{ path('sylius_shop_product_index', {'slug': taxon.slug, '_locale': taxon.translation.locale}) }}" class="item" {{ sylius_test_html_attribute('menu-item') }}>{{ taxon.name }}</a> <a href="{{ path('sylius_shop_product_index', {'slug': taxon.slug, '_locale': taxon.translation.locale}) }}" class="item" {{ sylius_test_html_attribute('menu-item', taxon.name) }}>{{ taxon.name }}</a>
{% endif %} {% endif %}
{% endmacro %} {% endmacro %}