You are here

private function MagicJSTestCase::the_js_files in Magic 7.2

1 call to MagicJSTestCase::the_js_files()
MagicJSTestCase::testMagicJSExcludes in ./magic.test
Test magic_assets_exclude().

File

./magic.test, line 207
A few tests to ensure the magic module is doing what it should be.

Class

MagicJSTestCase
An even quicker test to ensure that we have the right CSS gets returned when we run our regex to selectively remove files.

Code

private function the_js_files($files = null) {

  // Will grab the active theme.
  $theme = drupal_get_path('theme', $GLOBALS['theme_key']);
  $js_files = array(
    'overlay' => array(
      'type' => 'file',
      'data' => 'modules/overlay/js/overlay.js',
    ),
    'ctools' => array(
      'type' => 'file',
      'data' => 'sites/all/modules/contrib/ctools/js/ctools.js',
    ),
    'theme' => array(
      'type' => 'file',
      'data' => $theme . '/js/main.js',
    ),
    'external' => array(
      'type' => 'external',
      'data' => '//external.file.com/folder/filename.js',
    ),
    'inline' => array(
      'type' => 'inline',
      'data' => 'jQuery();',
    ),
  );
  $return = array();
  if ($files == null) {
    $files = array_keys($js_files);
  }
  foreach ($js_files as $name => $data) {
    if (in_array($name, $files)) {
      $return[] = $data;
    }
  }
  return $return;
}