comparison core/modules/locale/tests/src/Functional/LocaleLibraryAlterTest.php @ 0:4c8ae668cc8c

Initial import (non-working)
author Chris Cannam
date Wed, 29 Nov 2017 16:09:58 +0000
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:4c8ae668cc8c
1 <?php
2
3 namespace Drupal\Tests\locale\Functional;
4
5 use Drupal\Core\Asset\AttachedAssets;
6 use Drupal\Tests\BrowserTestBase;
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 BrowserTestBase {
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 }