1 common.test CommonJavaScriptTestCase::testLibraryAlter()

Adds a JavaScript library to the page and alters it.

See also

common_test_library_info_alter()

File

core/modules/simpletest/tests/common.test, line 1829
Tests for common.inc functionality.

Class

CommonJavaScriptTestCase
Tests for the JavaScript system.

Code

function testLibraryAlter() {
  // Verify that common_test altered the title of Farbtastic.
  $library = backdrop_get_library('system', 'farbtastic');
  $this->assertEqual($library['title'], 'Farbtastic: Altered Library', 'Registered libraries were altered.');

  // common_test_library_info_alter() also added a dependency on jQuery Form.
  backdrop_add_library('system', 'farbtastic');
  $scripts = backdrop_get_js();
  $this->assertTrue(strpos($scripts, 'core/misc/jquery.form.js'), 'Altered library dependencies are added to the page.');
}