68996f44a20884c3d769769983788fa5af2b0673
[yaffs-website] / web / core / modules / locale / src / Tests / LocaleLibraryAlterTest.php
1 <?php
2
3 namespace Drupal\locale\Tests;
4
5 use Drupal\Core\Asset\AttachedAssets;
6 use Drupal\simpletest\WebTestBase;
7
8 /**
9  * Tests localization of the JavaScript libraries.
10  *
11  * Currently, only the jQuery datepicker is localized using Drupal translations.
12  *
13  * @group locale
14  */
15 class LocaleLibraryAlterTest extends WebTestBase {
16
17   /**
18    * Modules to enable.
19    *
20    * @var array
21    */
22   public static $modules = ['locale'];
23
24   /**
25    * Verifies that the datepicker can be localized.
26    *
27    * @see locale_library_alter()
28    */
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.');
34   }
35
36 }