function JavaScriptTestCase::testRenderDifferentWeight

7.x common.test JavaScriptTestCase::testRenderDifferentWeight()

Test rendering the JavaScript with a file's weight above jQuery's.

File

drupal-7.x/modules/simpletest/tests/common.test, line 1461
Tests for common.inc functionality.

Class

JavaScriptTestCase
Tests for the JavaScript system.

Code

function testRenderDifferentWeight() {
  // JavaScript files are sorted first by group, then by the 'every_page'
  // flag, then by weight (see drupal_sort_css_js()), so to test the effect of
  // weight, we need the other two options to be the same.
  drupal_add_js('misc/collapse.js', array('group' => JS_LIBRARY, 'every_page' => TRUE, 'weight' => -21));
  $javascript = drupal_get_js();
  $this->assertTrue(strpos($javascript, 'misc/collapse.js') < strpos($javascript, 'misc/jquery.js'), 'Rendering a JavaScript file above jQuery.');
}