function JavaScriptTestCase::testRenderDifferentWeight

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

File

modules/simpletest/tests/common.test, line 1923

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.');
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.