1 common.test | CommonJavaScriptTestCase::testAddFile() |
Test adding a JavaScript file.
File
- core/
modules/ simpletest/ tests/ common.test, line 1391 - Tests for common.inc functionality.
Class
- CommonJavaScriptTestCase
- Tests for the JavaScript system.
Code
function testAddFile() {
$javascript = backdrop_add_js('core/misc/collapse.js');
$this->assertTrue(array_key_exists('core/misc/jquery.js', $javascript), 'jQuery is added when a file is added.');
$this->assertTrue(array_key_exists('core/misc/backdrop.js', $javascript), 'Backdrop.js is added when file is added.');
$this->assertTrue(array_key_exists('core/misc/collapse.js', $javascript), 'JavaScript files are correctly added.');
$this->assertEqual(base_path(), $javascript['settings']['data'][0]['basePath'], 'Base path JavaScript setting is correctly set.');
url('', array('prefix' => &$prefix));
$this->assertEqual(empty($prefix) ? '' : $prefix, $javascript['settings']['data'][1]['pathPrefix'], 'Path prefix JavaScript setting is correctly set.');
}