Unverified Commit 364ecc6c authored by Lauri Timmanee's avatar Lauri Timmanee
Browse files

Issue #3225241 by mherchel, andy-blum, Gauravmahlawat, shaal, jwitkowski79,...

Issue #3225241 by mherchel, andy-blum, Gauravmahlawat, shaal, jwitkowski79, nod_: Olivero primary menu JS completely breaks if site-builder specifies over 2 levels deep
parent 2c2da2b6
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -10,6 +10,12 @@ olivero_test.child:
  parent: olivero_test.front_page
  menu_name: main
  weight: 100
olivero_test.child_child:
  title: Child link
  route_name: <front>
  parent: olivero_test.child
  menu_name: main
  weight: 100
olivero_test.button:
  title: Button
  route_name: <button>
+16 −4
Original line number Diff line number Diff line
const headerNavSelector = '#header-nav';
const linkSubMenuId = 'home-submenu-1';
const buttonSubMenuId = 'button-submenu-2';
const linkSubMenuId = 'primary-menu-item-1';
const buttonSubMenuId = 'primary-menu-item-12';

module.exports = {
  '@tags': ['core', 'olivero'],
  before(browser) {
    browser.drupalInstall({
    browser
      .drupalInstall({
        setupFile:
          'core/tests/Drupal/TestSite/TestSiteOliveroInstallTestScript.php',
        installProfile: 'minimal',
      })
      // Login and change max-nesting depth so we can verify that menu levels
      // greater than 2 do not break the site.
      .drupalLoginAsAdmin(() => {
        browser
          .drupalRelativeURL('/admin/structure/block/manage/olivero_main_menu')
          .waitForElementVisible('[data-drupal-selector="edit-settings-depth"]')
          .setValue('[data-drupal-selector="edit-settings-depth"]', 'Unlimited')
          .click('[data-drupal-selector="edit-actions-submit"]')
          .waitForElementVisible('body');
      });
    browser.resizeWindow(1600, 800);
  },
@@ -32,7 +43,8 @@ module.exports = {
        'aria-expanded',
        'true',
      )

      // Verify tertiary menu item exists.
      .assert.visible('#primary-menu-item-11 .primary-nav__menu-link--level-3')
      // Test interactions for route:<button> menu links.
      .assert.not.visible(`#${buttonSubMenuId}`)
      .assert.attributeEquals(
+2 −2
Original line number Diff line number Diff line
const mobileNavButtonSelector = 'button.mobile-nav-button';
const headerNavSelector = '#header-nav';
const linkSubMenuId = 'home-submenu-1';
const buttonSubMenuId = 'button-submenu-2';
const linkSubMenuId = 'primary-menu-item-1';
const buttonSubMenuId = 'primary-menu-item-12';

/**
 * Sends arbitrary number of tab keys, and then checks that the last focused
+11 −0
Original line number Diff line number Diff line
@@ -314,6 +314,17 @@
  }
  }

/*
 * Olivero doesn't officially support nested tertiary submenus, but this
 * ensures that it doesn't break all the way.
 *
 * @see https://www.drupal.org/project/drupal/issues/3221399
 */

.primary-nav__menu--level-2 .primary-nav__menu-item--has-children {
  display: block;
}

.primary-nav__menu-link--level-2 {
  font-size: 1rem;
  font-weight: normal;
+10 −0
Original line number Diff line number Diff line
@@ -167,6 +167,16 @@
  }
}

/*
 * Olivero doesn't officially support nested tertiary submenus, but this
 * ensures that it doesn't break all the way.
 *
 * @see https://www.drupal.org/project/drupal/issues/3221399
 */
.primary-nav__menu--level-2 .primary-nav__menu-item--has-children {
  display: block;
}

.primary-nav__menu-link--level-2 {
  font-size: 16px;
  font-weight: normal;
Loading