diff --git a/helfi_navigation.module b/helfi_navigation.module index 05e2a8a..827e152 100644 --- a/helfi_navigation.module +++ b/helfi_navigation.module @@ -153,6 +153,9 @@ function helfi_navigation_page_attachments(array &$attachments) : void { $apiManager = Drupal::service('helfi_navigation.api_manager'); try { + // Ensure that drupalSettings library is enabled (menu library is not loaded in all tests). + $attachments['#attached']['library'][] = 'core/drupalSettings'; + $attachments['#attached']['drupalSettings']['helfi_navigation'] = [ 'links' => [ 'api' => $apiManager->getUrl('js', $langcode, ['endpoint' => '/api/v1/global-mobile-menu']),