mirror of
https://github.com/jbcr/core.git
synced 2026-03-30 21:02:07 +02:00
Add e2e test for menu
This commit is contained in:
@@ -5,7 +5,7 @@ main:
|
||||
- label: Home
|
||||
title: This is the <b>first<b> menu item.
|
||||
link: homepage
|
||||
class: first
|
||||
class: homepage
|
||||
- label: About
|
||||
link: blocks/about
|
||||
submenu:
|
||||
@@ -23,7 +23,7 @@ main:
|
||||
link: pages/
|
||||
- label: The Bolt site
|
||||
link: https://bolt.cm
|
||||
class: last
|
||||
class: bolt-site
|
||||
title: Visit the excellent Bolt website!
|
||||
|
||||
foo: bar
|
||||
@@ -24,7 +24,7 @@
|
||||
{{- item.label -}}
|
||||
</a>
|
||||
|
||||
{% if item.submenu is defined and withsubmenus %}
|
||||
{% if item.submenu and withsubmenus %}
|
||||
<ul class="menu submenu vertical">
|
||||
{% for submenu in item.submenu %}
|
||||
{{ display_menu_item(submenu, loop) }}
|
||||
|
||||
@@ -37,12 +37,12 @@ class FrontendMenuBuilder
|
||||
$this->fieldRepository = $fieldRepository;
|
||||
}
|
||||
|
||||
public function getMenu(string $name = ''): ?DeepCollection
|
||||
public function getMenu(?string $name = null): ?DeepCollection
|
||||
{
|
||||
/** @var DeepCollection $menuConfig */
|
||||
$menuConfig = $this->config->get('menu');
|
||||
|
||||
if ($name === '' && is_iterable($menuConfig)) {
|
||||
if (! $name && is_iterable($menuConfig)) {
|
||||
$menu = $menuConfig->first();
|
||||
} elseif ($name !== '' && isset($menuConfig[$name])) {
|
||||
$menu = $menuConfig[$name];
|
||||
|
||||
7
tests/e2e/features/frontend_menu.feature
Normal file
7
tests/e2e/features/frontend_menu.feature
Normal file
@@ -0,0 +1,7 @@
|
||||
Feature: Frontend menu
|
||||
@wip
|
||||
Scenario: As a user I want to see the menu in the frontend
|
||||
When I visit the "homepage" page
|
||||
Then there is element "menu_first" with text "Home"
|
||||
And there is element "menu_last" with text "The Bolt site"
|
||||
And there are "eq 4" "menu_sub" elements
|
||||
@@ -11,6 +11,11 @@ class HomepagePage extends BasePage {
|
||||
|
||||
this.search_input = $('#searchform-inline input[name="searchTerm"');
|
||||
this.search_button = $('#searchform-inline button');
|
||||
|
||||
// Attributes for testing the menu
|
||||
this.menu_first = $('ul.menu li.first');
|
||||
this.menu_sub = $$('ul.menu li.has-submenu li');
|
||||
this.menu_last = $('ul.menu li.last a.bolt-site');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user