Skip to content
LocaleLibraryInfoAlterTest.php 1.02 KiB
Newer Older
<?php
/**
 * @file
 * Definition of Drupal\locale\Tests\LocaleLibraryInfoAlterTest.
 */

namespace Drupal\locale\Tests;

use Drupal\simpletest\WebTestBase;

/**
 * Tests localization of the JavaScript libraries.
 *
 * Currently, only the jQuery datepicker is localized using Drupal translations.
 */
class LocaleLibraryInfoAlterTest extends WebTestBase {

  /**
   * Modules to enable.
   *
   * @var array
   */
  public static $modules = array('locale');

  public static function getInfo() {
    return array(
      'description' => 'Tests localization of the JavaScript libraries.',
      'group' => 'Locale',
    );
  }

  /**
     * Verifies that the datepicker can be localized.
     *
     * @see locale_library_info_alter()
     */
  public function testLibraryInfoAlter() {
    drupal_add_library('system', 'jquery.ui.datepicker');
    $scripts = drupal_get_js();
    $this->assertTrue(strpos($scripts, 'locale.datepicker.js'), t('locale.datepicker.js added to scripts.'));
  }
}