function LocaleLibraryAlterTest::testLibraryAlter

Verifies that the datepicker can be localized.

See also

locale_library_alter()

File

core/modules/locale/tests/src/Kernel/LocaleLibraryAlterTest.php, line 27

Class

LocaleLibraryAlterTest
Tests localization of the JavaScript libraries.

Namespace

Drupal\Tests\locale\Kernel

Code

public function testLibraryAlter() {
  $this->installSchema('locale', [
    'locales_location',
    'locales_source',
  ]);
  $assets = new AttachedAssets();
  $assets->setLibraries([
    'core/jquery.ui.datepicker',
  ]);
  $js_assets = $this->container
    ->get('asset.resolver')
    ->getJsAssets($assets, FALSE)[1];
  $this->assertArrayHasKey('core/modules/locale/locale.datepicker.js', $js_assets);
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.