function JavaScriptTestCase::testAttachedLibrary
Tests the addition of libraries through the #attached['library'] property.
File
-
modules/
simpletest/ tests/ common.test, line 2004
Class
- JavaScriptTestCase
- Tests for the JavaScript system.
Code
function testAttachedLibrary() {
$element['#attached']['library'][] = array(
'system',
'farbtastic',
);
drupal_render($element);
$scripts = drupal_get_js();
$this->assertTrue(strpos($scripts, 'misc/farbtastic/farbtastic.js'), 'The attached_library property adds the additional libraries.');
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.