function CoderReviewUpgrade7xTest::testJavascript7x in Coder 7
Same name and namespace in other branches
- 7.2 coder_review/tests/coder_review_7x.test \CoderReviewUpgrade7xTest::testJavascript7x()
File
- coder_review/
tests/ coder_review_7x.test, line 381
Class
Code
function testJavascript7x() {
// N/A - http://drupal.org/node/224333#jquery_ui
// N/A - http://drupal.org/node/224333#attached_js
// N/A - http://drupal.org/node/224333#drupal_add_library
// N/A - http://drupal.org/node/224333#drupal_add_js_css_reset
// N/A - http://drupal.org/node/224333#local_settings_behaviors
// NO TESTS - http://drupal.org/node/224333#jquery_13
// NO TESTS - http://drupal.org/node/224333#drupal_behaviors
// NO TESTS - http://drupal.org/node/224333#javascript_compatibility
// NO TESTS - http://drupal.org/node/224333#no-jsenabled
// http://drupal.org/node/224333#drupal_add_js_weight
$this
->assertCoderReviewFail(" drupal_add_js(\$data, 'module');");
// http://drupal.org/node/224333#drupal_add_js_options
$this
->assertCoderReviewPass(" drupal_add_js(\$data, 'file');");
$this
->assertCoderReviewFail(" drupal_add_js(\$data, 'file', 'header');");
$this
->assertCoderReviewFail(" drupal_add_js(\$data, 'file', \$header, \$defer);");
$this
->assertCoderReviewPass(" drupal_add_js(\$jquery_plugin, array('weight' => JS_LIBRARY));");
// http://drupal.org/node/224333#hook_js_alter
$this
->assertCoderReviewPass(" function mytheme_preprocess_page(&\$variables) {\n \$scripts = \$variables['myscripts'];\n}");
$this
->assertCoderReviewFail(" function mytheme_preprocess_page(&\$variables) {\n \$scripts = \$variables['scripts'];\n}");
// http://drupal.org/node/224333#drupal_add_js_external
$this
->assertCoderReviewPass(' drupal_add_html_head("foo");');
$this
->assertCoderReviewFail(' drupal_add_html_head(\'<script type="text/javascript" src="foo.js"/>\');');
$this
->assertCoderReviewFail(' drupal_add_html_head(\'<script src="foo.js">\');');
$this
->assertCoderReviewFail(' drupal_add_html_head(\'<script src="http://example.com/foo.js">\');');
$this
->assertCoderReviewFail(' drupal_add_html_head(\'<script src="/files/foo.js">\');');
$this
->assertCoderReviewFail(' drupal_add_html_head(\'<script src="http://example123-ab_c.com.js">\');');
// http://drupal.org/node/224333#jquery_once
// http://drupal.org/node/224333#rename-drupal-to-js
}