diff --git a/core/core.libraries.yml b/core/core.libraries.yml index 825ed77..1d3a011 100644 --- a/core/core.libraries.yml +++ b/core/core.libraries.yml @@ -8,7 +8,7 @@ backbone: url: https://github.com/jashkenas/backbone/blob/1.1.2/LICENSE gpl-compatible: true js: - assets/vendor/backbone/backbone-min.js: { weight: -19, minified: true } + assets/vendor/backbone/backbone-min.js: { minified: true } dependencies: - core/underscore @@ -20,7 +20,7 @@ classList: url: https://github.com/eligrey/classList.js/blob/2014-12-13/LICENSE.md gpl-compatible: true js: - assets/vendor/classList/classList.min.js: { weight: -21, browsers: { IE: 'lte IE 9', '!IE': false }, minified: true } + assets/vendor/classList/classList.min.js: { browsers: { IE: 'lte IE 9', '!IE': false }, minified: true } ckeditor: remote: https://github.com/ckeditor/ckeditor-dev @@ -40,12 +40,12 @@ domready: url: https://github.com/ded/domready/blob/v1.0.7/LICENSE gpl-compatible: true js: - assets/vendor/domready/ready.min.js: { weight: -21, minified: true } + assets/vendor/domready/ready.min.js: { minified: true } drupal: version: VERSION js: - misc/drupal.js: { weight: -18 } + misc/drupal.js: {} dependencies: - core/domready - core/drupalSettings @@ -102,7 +102,7 @@ drupal.announce: drupal.autocomplete: version: VERSION js: - misc/autocomplete.js: { weight: -1 } + misc/autocomplete.js: {} dependencies: - core/jquery - core/drupal @@ -246,7 +246,7 @@ drupal.tabbingmanager: drupal.tabledrag: version: VERSION js: - misc/tabledrag.js: { weight: -1 } + misc/tabledrag.js: {} dependencies: - core/jquery - core/modernizr @@ -297,7 +297,7 @@ drupal.vertical-tabs: version: VERSION js: # Load before core/drupal.collapse. - misc/vertical-tabs.js: { weight: -1 } + misc/vertical-tabs.js: {} css: component: misc/vertical-tabs.css: {} @@ -318,7 +318,7 @@ html5shiv: url: http://www.gnu.org/licenses/gpl-2.0.html gpl-compatible: true js: - assets/vendor/html5shiv/html5shiv.min.js: { every_page: true, weight: -22, browsers: { IE: 'lte IE 8', '!IE': false }, minified: true } + assets/vendor/html5shiv/html5shiv.min.js: { every_page: true, browsers: { IE: 'lte IE 8', '!IE': false }, minified: true } jquery: remote: https://github.com/jquery/jquery @@ -328,7 +328,7 @@ jquery: url: https://github.com/jquery/jquery/blob/2.1.3/MIT-LICENSE.txt gpl-compatible: true js: - assets/vendor/jquery/jquery.min.js: { minified: true, weight: -20 } + assets/vendor/jquery/jquery.min.js: { minified: true } jquery.cookie: remote: https://github.com/carhartl/jquery-cookie @@ -398,7 +398,7 @@ jquery.once: url: https://github.com/RobLoach/jquery-once/blob/1.2.3/LICENSE gpl-compatible: true js: - assets/vendor/jquery-once/jquery.once.js: { weight: -19 } + assets/vendor/jquery-once/jquery.once.js: {} dependencies: - core/jquery @@ -410,7 +410,7 @@ jquery.ui: url: https://github.com/jquery/jquery-ui/blob/1.11.2/MIT-LICENSE.txt gpl-compatible: true js: - assets/vendor/jquery.ui/ui/core-min.js: { weight: -11, minified: true } + assets/vendor/jquery.ui/ui/core-min.js: { minified: true } css: component: assets/vendor/jquery.ui/themes/base/core.css: {} @@ -510,7 +510,7 @@ jquery.ui.effects.core: version: *jquery_ui_version license: *jquery_ui_license js: - assets/vendor/jquery.ui/ui/effect-min.js: { weight: -9, minified: true } + assets/vendor/jquery.ui/ui/effect-min.js: { minified: true } jquery.ui.effects.blind: version: *jquery_ui_version @@ -787,7 +787,7 @@ jquery.ui.widget: version: *jquery_ui_version license: *jquery_ui_license js: - assets/vendor/jquery.ui/ui/widget-min.js: { weight: -10, minified: true } + assets/vendor/jquery.ui/ui/widget-min.js: { minified: true } dependencies: - core/jquery.ui @@ -819,7 +819,7 @@ modernizr: gpl-compatible: true version: v2.8.3 js: - assets/vendor/modernizr/modernizr.min.js: { every_page: true, preprocess: 0, weight: -21, minified: true } + assets/vendor/modernizr/modernizr.min.js: { every_page: true, preprocess: 0 } normalize: remote: https://github.com/necolas/normalize.css @@ -830,7 +830,7 @@ normalize: gpl-compatible: true css: base: - assets/vendor/normalize-css/normalize.css: { every_page: true, weight: -20 } + assets/vendor/normalize-css/normalize.css: { every_page: true } picturefill: remote: https://github.com/scottjehl/picturefill @@ -842,7 +842,7 @@ picturefill: url: https://github.com/scottjehl/picturefill/blob/master/LICENSE gpl-compatible: true js: - assets/vendor/picturefill/picturefill.js: { weight: -10 } + assets/vendor/picturefill/picturefill.js: {} dependencies: - core/matchmedia @@ -854,4 +854,4 @@ underscore: url: https://github.com/jashkenas/underscore/blob/1.7.0/LICENSE gpl-compatible: true js: - assets/vendor/underscore/underscore-min.js: { weight: -20, minified: true } + assets/vendor/underscore/underscore-min.js: { minified: true } diff --git a/core/modules/contextual/contextual.libraries.yml b/core/modules/contextual/contextual.libraries.yml index 16961a6..425cec7 100644 --- a/core/modules/contextual/contextual.libraries.yml +++ b/core/modules/contextual/contextual.libraries.yml @@ -3,14 +3,14 @@ drupal.contextual-links: js: # Ensure to run before contextual/drupal.context-toolbar. # Core. - js/contextual.js: { weight: -2 } + js/contextual.js: {} # Models. - js/models/StateModel.js: { weight: -2 } + js/models/StateModel.js: {} # Views. - js/views/AuralView.js: { weight: -2 } - js/views/KeyboardView.js: { weight: -2 } - js/views/RegionView.js: { weight: -2 } - js/views/VisualView.js: { weight: -2 } + js/views/AuralView.js: {} + js/views/KeyboardView.js: {} + js/views/RegionView.js: {} + js/views/VisualView.js: {} css: component: css/contextual.module.css: {} diff --git a/core/modules/simpletest/simpletest.module b/core/modules/simpletest/simpletest.module index 052e0b7..55e62af 100644 --- a/core/modules/simpletest/simpletest.module +++ b/core/modules/simpletest/simpletest.module @@ -49,18 +49,6 @@ function simpletest_theme() { } /** - * Implements hook_js_alter(). - */ -function simpletest_js_alter(&$javascript, AttachedAssetsInterface $assets) { - // Since SimpleTest is a special use case for the table select, stick the - // SimpleTest JavaScript above the table select. - $simpletest = drupal_get_path('module', 'simpletest') . '/simpletest.js'; - if (array_key_exists($simpletest, $javascript) && array_key_exists('core/misc/tableselect.js', $javascript)) { - $javascript[$simpletest]['weight'] = $javascript['core/misc/tableselect.js']['weight'] - 1; - } -} - -/** * Prepares variables for simpletest result summary templates. * * Default template: simpletest-result-summary.html.twig. diff --git a/core/modules/system/src/Tests/Common/AttachedAssetsTest.php b/core/modules/system/src/Tests/Common/AttachedAssetsTest.php index 10bf818..8098fdd 100644 --- a/core/modules/system/src/Tests/Common/AttachedAssetsTest.php +++ b/core/modules/system/src/Tests/Common/AttachedAssetsTest.php @@ -389,21 +389,23 @@ function testRenderDifferentWeight() { /** * Tests altering a JavaScript's weight via hook_js_alter(). * - * @see simpletest_js_alter() + * @see attached_assets_test_js_alter() */ function testAlter() { - // Add both tableselect.js and simpletest.js. - $build['#attached']['library'][] = 'core/drupal.tableselect'; - $build['#attached']['library'][] = 'simpletest/drupal.simpletest'; + // Enable a test module that alters JS. + $this->enableModules(['attached_assets_test']); + + // Add jQuery. + $build['#attached']['library'][] = 'core/jquery'; $assets = AttachedAssets::createFromRenderArray($build); - // Render the JavaScript, testing if simpletest.js was altered to be before - // tableselect.js. See simpletest_js_alter() to see where this alteration - // takes place. + // Render the JavaScript, testing if attached_assets_test.js was added. See + // attached_assets_test_js_alter() to see this file being added using + // hook_js_alter(). $js = $this->assetResolver->getJsAssets($assets, FALSE)[1]; $js_render_array = \Drupal::service('asset.js.collection_renderer')->render($js); $rendered_js = $this->renderer->render($js_render_array); - $this->assertTrue(strpos($rendered_js, 'simpletest.js') < strpos($rendered_js, 'core/misc/tableselect.js'), 'Altering JavaScript weight through the alter hook.'); + $this->assertTrue(strpos($rendered_js, 'attached_assets_test.js') > 0, 'Altering JavaScript weight through the alter hook.'); } /** diff --git a/core/modules/system/system.libraries.yml b/core/modules/system/system.libraries.yml index 34c90dd..20bdb64 100644 --- a/core/modules/system/system.libraries.yml +++ b/core/modules/system/system.libraries.yml @@ -3,9 +3,9 @@ base: css: # Adjust the weights to load these early. component: - css/system.module.css: { every_page: true, weight: -10, } + css/system.module.css: { every_page: true } theme: - css/system.theme.css: { every_page: true, weight: -10 } + css/system.theme.css: { every_page: true } dependencies: - core/normalize @@ -13,7 +13,7 @@ admin: version: VERSION css: theme: - css/system.admin.css: { weight: -10 } + css/system.admin.css: {} dependencies: - system/base @@ -21,7 +21,7 @@ maintenance: version: VERSION css: theme: - css/system.maintenance.css: { weight: -10 } + css/system.maintenance.css: {} dependencies: - system/base - system/admin diff --git a/core/modules/system/tests/modules/attached_assets_test/attached_assets_test.info.yml b/core/modules/system/tests/modules/attached_assets_test/attached_assets_test.info.yml new file mode 100644 index 0000000..c6b147d --- /dev/null +++ b/core/modules/system/tests/modules/attached_assets_test/attached_assets_test.info.yml @@ -0,0 +1,6 @@ +name: 'Attached assets mock module' +type: module +description: 'Test for attached asset calls.' +core: 8.x +package: Testing +version: VERSION diff --git a/core/modules/system/tests/modules/attached_assets_test/attached_assets_test.js b/core/modules/system/tests/modules/attached_assets_test/attached_assets_test.js new file mode 100644 index 0000000..6a78081c5 --- /dev/null +++ b/core/modules/system/tests/modules/attached_assets_test/attached_assets_test.js @@ -0,0 +1,4 @@ +/** + * @file + * Empty JavaScript file to test attached assets. + */ diff --git a/core/modules/system/tests/modules/attached_assets_test/attached_assets_test.module b/core/modules/system/tests/modules/attached_assets_test/attached_assets_test.module new file mode 100644 index 0000000..adf41d0 --- /dev/null +++ b/core/modules/system/tests/modules/attached_assets_test/attached_assets_test.module @@ -0,0 +1,17 @@ +