diff --git a/core/modules/system/tests/modules/olivero_test/js/log-errors.es6.js b/core/modules/system/tests/modules/olivero_test/js/log-errors.es6.js new file mode 100644 index 0000000000000000000000000000000000000000..676f0a50190f33a8d99c823da08afede4542c0ce --- /dev/null +++ b/core/modules/system/tests/modules/olivero_test/js/log-errors.es6.js @@ -0,0 +1,10 @@ +/** + * @file + * Log all errors. + */ + +Drupal.errorLog = []; + +window.addEventListener('error', (e) => { + Drupal.errorLog.push(e); +}); diff --git a/core/modules/system/tests/modules/olivero_test/js/log-errors.js b/core/modules/system/tests/modules/olivero_test/js/log-errors.js new file mode 100644 index 0000000000000000000000000000000000000000..28057970e8dd38ea787e1efc18c41b9a0c29c66a --- /dev/null +++ b/core/modules/system/tests/modules/olivero_test/js/log-errors.js @@ -0,0 +1,11 @@ +/** +* DO NOT EDIT THIS FILE. +* See the following change record for more information, +* https://www.drupal.org/node/2815083 +* @preserve +**/ + +Drupal.errorLog = []; +window.addEventListener('error', function (e) { + Drupal.errorLog.push(e); +}); \ No newline at end of file diff --git a/core/modules/system/tests/modules/olivero_test/olivero_test.libraries.yml b/core/modules/system/tests/modules/olivero_test/olivero_test.libraries.yml new file mode 100644 index 0000000000000000000000000000000000000000..019dfb519d51042bbcb400e014fb20bb8b4de133 --- /dev/null +++ b/core/modules/system/tests/modules/olivero_test/olivero_test.libraries.yml @@ -0,0 +1,5 @@ +log-errors: + js: + js/log-errors.js: { weight: -15 } + dependencies: + - core/drupal diff --git a/core/modules/system/tests/modules/olivero_test/olivero_test.module b/core/modules/system/tests/modules/olivero_test/olivero_test.module index 6be87370e6ebe090e8d346ac5eb716ec1b9136e2..5c2c0c4a44e727c60c28c5b882dcfa71c48bd37b 100644 --- a/core/modules/system/tests/modules/olivero_test/olivero_test.module +++ b/core/modules/system/tests/modules/olivero_test/olivero_test.module @@ -14,3 +14,10 @@ function olivero_test_preprocess_field_multiple_value_form(&$variables) { $variables['element']['#disabled'] = TRUE; } } + +/** + * Implements hook_preprocess_html(). + */ +function olivero_test_preprocess_html(&$variables) { + $variables['#attached']['library'][] = 'olivero_test/log-errors'; +} diff --git a/core/tests/Drupal/Nightwatch/Tests/Olivero/oliveroRemoveBlockConsoleTest.js b/core/tests/Drupal/Nightwatch/Tests/Olivero/oliveroRemoveBlockConsoleTest.js new file mode 100644 index 0000000000000000000000000000000000000000..451f5d47dc23083e4263742fcafba112ab3bbe6b --- /dev/null +++ b/core/tests/Drupal/Nightwatch/Tests/Olivero/oliveroRemoveBlockConsoleTest.js @@ -0,0 +1,57 @@ +module.exports = { + '@tags': ['core', 'olivero'], + before(browser) { + browser + .drupalInstall({ + setupFile: + 'core/tests/Drupal/TestSite/TestSiteOliveroInstallTestScript.php', + installProfile: 'minimal', + }) + .drupalLoginAsAdmin(() => { + browser + .drupalRelativeURL('/admin/structure/block') + + // Disable narrow search form block. + .click( + '[data-drupal-selector="edit-blocks-olivero-search-form-narrow-operations"] .dropbutton-toggle button', + ) + .click('[href*="olivero_search_form_narrow/disable"]') + + // Disable main menu block. + .click( + '[data-drupal-selector="edit-blocks-olivero-main-menu-operations"] .dropbutton-toggle button', + ) + .click('[href*="olivero_main_menu/disable"]') + + // Disable wide search form block. + .click( + '[data-drupal-selector="edit-blocks-olivero-search-form-wide-operations"] .dropbutton-toggle button', + ) + .click('[href*="olivero_search_form_wide/disable"]') + + // Disable user account menu block. + .click( + '[data-drupal-selector="edit-blocks-olivero-account-menu-operations"] .dropbutton-toggle button', + ) + .click('[href*="olivero_account_menu/disable"]'); + }); + }, + after(browser) { + browser.drupalUninstall(); + }, + 'Verify no console errors': (browser) => { + browser + .drupalRelativeURL('/') + .waitForElementVisible('body') + .execute( + // eslint-disable-next-line func-names, prefer-arrow-callback, no-shadow + function () { + return Drupal.errorLog.length === 0; + }, + [], + (result) => { + browser.assert.ok(result.value, 'Verify no console errors exist.'); + }, + ); + }, +}; diff --git a/core/themes/olivero/olivero.libraries.yml b/core/themes/olivero/olivero.libraries.yml index ec50de44e9db9786db96c29cc31ff180e49a79a1..90561c40c8a39e72179ccde38726fb5dc6582a89 100644 --- a/core/themes/olivero/olivero.libraries.yml +++ b/core/themes/olivero/olivero.libraries.yml @@ -40,10 +40,6 @@ global-styling: css/components/links.css: {} css/components/messages.css: {} css/components/navigation/nav-button-mobile.css: {} - css/components/navigation/nav-primary-button.css: {} - css/components/navigation/nav-primary.css: {} - css/components/navigation/nav-primary-wide.css: {} - css/components/navigation/nav-secondary.css: {} css/components/node.css: {} css/components/node-teaser.css: {} css/components/page-title.css: {} @@ -58,8 +54,7 @@ global-styling: js: js/checkbox.js: {} js/navigation-utils.js: {} - js/navigation.js: {} - js/second-level-navigation.js: {} + dependencies: - core/drupal.element.closest - core/drupal.element.matches @@ -213,6 +208,23 @@ messages: js: js/messages.js: {} +navigation-primary: + version: VERSION + css: + component: + css/components/navigation/nav-primary.css: {} + css/components/navigation/nav-primary-button.css: {} + css/components/navigation/nav-primary-wide.css: {} + js: + js/navigation.js: {} + js/second-level-navigation.js: {} + +navigation-secondary: + version: VERSION + css: + component: + css/components/navigation/nav-secondary.css: {} + powered-by-block: version: VERSION css: diff --git a/core/themes/olivero/templates/navigation/menu--primary-menu.html.twig b/core/themes/olivero/templates/navigation/menu--primary-menu.html.twig index 4d2c73bb73ff5891910c7da40956e53a9e02039c..20dcd1915fe1c7a7581d79195d8000d277622e0d 100644 --- a/core/themes/olivero/templates/navigation/menu--primary-menu.html.twig +++ b/core/themes/olivero/templates/navigation/menu--primary-menu.html.twig @@ -20,6 +20,8 @@ * @ingroup themeable */ #} +{{ attach_library('olivero/navigation-primary') }} + {% import _self as menus %} {# diff --git a/core/themes/olivero/templates/navigation/menu--secondary-menu.html.twig b/core/themes/olivero/templates/navigation/menu--secondary-menu.html.twig index ea404f624b25d94c4017ffea7252e58e2e96e00e..27520da59eaf1119f0be8a82d05a41f5d0ceb435 100644 --- a/core/themes/olivero/templates/navigation/menu--secondary-menu.html.twig +++ b/core/themes/olivero/templates/navigation/menu--secondary-menu.html.twig @@ -20,6 +20,8 @@ * @ingroup themeable */ #} +{{ attach_library('olivero/navigation-secondary') }} + {% import _self as menus %} {#