1 common.test CommonJavaScriptTestCase::testAddInline()

Test adding inline scripts.

File

core/modules/simpletest/tests/common.test, line 1466
Tests for common.inc functionality.

Class

CommonJavaScriptTestCase
Tests for the JavaScript system.

Code

function testAddInline() {
  $inline = 'jQuery(function () { });';
  $javascript = backdrop_add_js($inline, array('type' => 'inline', 'scope' => 'footer'));
  $this->assertTrue(array_key_exists('core/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.');
}