function JavaScriptTest::testDifferentWeight

Tests adding a JavaScript file with a different weight.

File

drupal/core/modules/system/lib/Drupal/system/Tests/Common/JavaScriptTest.php, line 274
Definition of Drupal\system\Tests\Common\JavaScriptTest.

Class

JavaScriptTest
Tests the JavaScript system.

Namespace

Drupal\system\Tests\Common

Code

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