1 common.test CommonJavaScriptTestCase::testRenderDifferentWeight()

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

File

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

Class

CommonJavaScriptTestCase
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 backdrop_sort_css_js()), so to test the effect of
  // weight, we need the other two options to be the same.
  backdrop_add_js('core/misc/collapse.js', array('group' => JS_LIBRARY, 'every_page' => TRUE, 'weight' => -21));
  $javascript = backdrop_get_js();
  $this->assertTrue(strpos($javascript, 'core/misc/collapse.js') < strpos($javascript, 'core/misc/jquery.js'), 'Rendering a JavaScript file above jQuery.');
}