3 namespace Drupal\locale\Tests;
5 use Drupal\Core\Asset\AttachedAssets;
6 use Drupal\simpletest\WebTestBase;
9 * Tests localization of the JavaScript libraries.
11 * Currently, only the jQuery datepicker is localized using Drupal translations.
15 class LocaleLibraryAlterTest extends WebTestBase {
22 public static $modules = ['locale'];
25 * Verifies that the datepicker can be localized.
27 * @see locale_library_alter()
29 public function testLibraryAlter() {
30 $assets = new AttachedAssets();
31 $assets->setLibraries(['core/jquery.ui.datepicker']);
32 $js_assets = $this->container->get('asset.resolver')->getJsAssets($assets, FALSE)[1];
33 $this->assertTrue(array_key_exists('core/modules/locale/locale.datepicker.js', $js_assets), 'locale.datepicker.js added to scripts.');