function JavaScriptTest::testAttachedLibrary

Tests the addition of libraries through the #attached['library'] property.

File

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

Class

JavaScriptTest
Tests the JavaScript system.

Namespace

Drupal\system\Tests\Common

Code

function testAttachedLibrary() {
  $element['#attached']['library'][] = array(
    'system',
    'jquery.farbtastic',
  );
  drupal_render($element);
  $scripts = drupal_get_js();
  $this
    ->assertTrue(strpos($scripts, 'core/misc/farbtastic/farbtastic.js'), 'The attached_library property adds the additional libraries.');
}