function JavaScriptTestCase::testAddInline
Test adding inline scripts.
File
-
modules/
simpletest/ tests/ common.test, line 1639
Class
- JavaScriptTestCase
- Tests for the JavaScript system.
Code
function testAddInline() {
$inline = 'jQuery(function () { });';
$javascript = drupal_add_js($inline, array(
'type' => 'inline',
'scope' => 'footer',
));
$this->assertTrue(array_key_exists('misc/jquery.js', $javascript), 'jQuery is added when inline scripts are added.');
$data = end($javascript);
$this->assertEqual($inline, $data['data'], 'Inline JavaScript is correctly added to the footer.');
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.