Skip to content

Commit

Permalink
UHF-9239: Fix core/drupalSettings not loaded in tests
Browse files Browse the repository at this point in the history
  • Loading branch information
hyrsky committed Jan 15, 2024
1 parent 8768deb commit 7868be6
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions helfi_navigation.module
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,10 @@ 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']),
Expand Down

0 comments on commit 7868be6

Please sign in to comment.