function JavaScriptTest::testLibraryRender

Adds a library to the page and tests for both its JavaScript and its CSS.

File

drupal/core/modules/system/lib/Drupal/system/Tests/Common/JavaScriptTest.php, line 449
Definition of Drupal\system\Tests\Common\JavaScriptTest.

Class

JavaScriptTest
Tests the JavaScript system.

Namespace

Drupal\system\Tests\Common

Code

function testLibraryRender() {
  $result = drupal_add_library('system', 'jquery.farbtastic');
  $this
    ->assertTrue($result !== FALSE, 'Library was added without errors.');
  $scripts = drupal_get_js();
  $styles = drupal_get_css();
  $this
    ->assertTrue(strpos($scripts, 'core/misc/farbtastic/farbtastic.js'), 'JavaScript of library was added to the page.');
  $this
    ->assertTrue(strpos($styles, 'core/misc/farbtastic/farbtastic.css'), 'Stylesheet of library was added to the page.');
}