You are here

function JavaScriptTestCase::testAddInline in SimpleTest 7

Test adding inline scripts.

File

tests/common.test, line 1034
Tests for common.inc functionality.

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), t('jQuery is added when inline scripts are added.'));
  $data = end($javascript);
  $this
    ->assertEqual($inline, $data['data'], t('Inline JavaScript is correctly added to the footer.'));
}