JavaScriptTestCase::testRenderDifferentWeight

7 common.test JavaScriptTestCase::testRenderDifferentWeight()

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

File

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

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'), t('Rendering a JavaScript file above jQuery.'));
}
Login or register to post comments