function JavaScriptTestCase::testDifferentWeight

Test adding a JavaScript file with a different weight.

File

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

Class

JavaScriptTestCase
Tests for the JavaScript system.

Code

function testDifferentWeight() {
  $javascript = drupal_add_js('misc/collapse.js', array(
    'weight' => 2,
  ));
  $this->assertEqual($javascript['misc/collapse.js']['weight'], 2, 'Adding a JavaScript file with a different weight caches the given weight.');
}

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