Commit 230f252b by Daniel Friedman Committed by Brian Jacobel

Fix the way jquery and jquery-migrate are loaded

Don't use symlinks to include node_modules
parent 665f983c
...@@ -27,12 +27,8 @@ ...@@ -27,12 +27,8 @@
"mustache": "js/vendor/mustache", "mustache": "js/vendor/mustache",
"codemirror": "js/vendor/codemirror-compressed", "codemirror": "js/vendor/codemirror-compressed",
"codemirror/stex": "js/vendor/CodeMirror/stex", "codemirror/stex": "js/vendor/CodeMirror/stex",
// The jquery-migrate library was added in upgrading from "jquery": "common/js/vendor/jquery",
// jQuery 1.7.x to 2.2.x. This config allows developers "jquery-migrate": "common/js/vendor/jquery-migrate",
// to depend on "jquery" which opaquely requires both
// libraries.
"_jquery": "js/vendor/jquery.min",
"jquery": "js/vendor/jquery-migrate.min",
"jquery.ui": "js/vendor/jquery-ui.min", "jquery.ui": "js/vendor/jquery-ui.min",
"jquery.form": "js/vendor/jquery.form", "jquery.form": "js/vendor/jquery.form",
"jquery.markitup": "js/vendor/markitup/jquery.markitup", "jquery.markitup": "js/vendor/markitup/jquery.markitup",
...@@ -117,10 +113,7 @@ ...@@ -117,10 +113,7 @@
"date": { "date": {
exports: "Date" exports: "Date"
}, },
"jquery": { "jquery-migrate": ['jquery'],
deps: ["_jquery"],
exports: "jQuery"
},
"jquery.ui": { "jquery.ui": {
deps: ["jquery"], deps: ["jquery"],
exports: "jQuery.ui" exports: "jQuery.ui"
......
...@@ -4,11 +4,8 @@ requirejs.config({ ...@@ -4,11 +4,8 @@ requirejs.config({
"gettext": "xmodule_js/common_static/js/test/i18n", "gettext": "xmodule_js/common_static/js/test/i18n",
"mustache": "xmodule_js/common_static/js/vendor/mustache", "mustache": "xmodule_js/common_static/js/vendor/mustache",
"codemirror": "xmodule_js/common_static/js/vendor/CodeMirror/codemirror", "codemirror": "xmodule_js/common_static/js/vendor/CodeMirror/codemirror",
# The jquery-migrate library was added in upgrading from "jquery": "xmodule_js/common_static/common/js/vendor/jquery",
# jQuery 1.7.x to 2.2.x. This config allows developers to "jquery-migrate": "xmodule_js/common_static/common/js/vendor/jquery-migrate",
# depend on "jquery" which opaquely requires both libraries.
"_jquery": "xmodule_js/common_static/js/vendor/jquery.min",
"jquery": "xmodule_js/common_static/js/vendor/jquery-migrate.min",
"jquery.ui": "xmodule_js/common_static/js/vendor/jquery-ui.min", "jquery.ui": "xmodule_js/common_static/js/vendor/jquery-ui.min",
"jquery.form": "xmodule_js/common_static/js/vendor/jquery.form", "jquery.form": "xmodule_js/common_static/js/vendor/jquery.form",
"jquery.markitup": "xmodule_js/common_static/js/vendor/markitup/jquery.markitup", "jquery.markitup": "xmodule_js/common_static/js/vendor/markitup/jquery.markitup",
...@@ -69,10 +66,7 @@ requirejs.config({ ...@@ -69,10 +66,7 @@ requirejs.config({
"date": { "date": {
exports: "Date" exports: "Date"
}, },
"jquery": { "jquery-migrate": ['jquery'],
deps: ["_jquery"],
exports: "jQuery"
},
"jquery.ui": { "jquery.ui": {
deps: ["jquery"], deps: ["jquery"],
exports: "jQuery.ui" exports: "jQuery.ui"
......
...@@ -5,7 +5,8 @@ requirejs.config({ ...@@ -5,7 +5,8 @@ requirejs.config({
"gettext": "xmodule_js/common_static/js/test/i18n", "gettext": "xmodule_js/common_static/js/test/i18n",
"mustache": "xmodule_js/common_static/js/vendor/mustache", "mustache": "xmodule_js/common_static/js/vendor/mustache",
"codemirror": "xmodule_js/common_static/js/vendor/CodeMirror/codemirror", "codemirror": "xmodule_js/common_static/js/vendor/CodeMirror/codemirror",
"jquery": "xmodule_js/common_static/js/vendor/jquery.min", "jquery": "xmodule_js/common_static/common/js/vendor/jquery",
"jquery-migrate": "xmodule_js/common_static/common/js/vendor/jquery-migrate",
"jquery.ui": "xmodule_js/common_static/js/vendor/jquery-ui.min", "jquery.ui": "xmodule_js/common_static/js/vendor/jquery-ui.min",
"jquery.form": "xmodule_js/common_static/js/vendor/jquery.form", "jquery.form": "xmodule_js/common_static/js/vendor/jquery.form",
"jquery.markitup": "xmodule_js/common_static/js/vendor/markitup/jquery.markitup", "jquery.markitup": "xmodule_js/common_static/js/vendor/markitup/jquery.markitup",
......
...@@ -14,7 +14,7 @@ class RequireJSPathOverridesTest(TestCase): ...@@ -14,7 +14,7 @@ class RequireJSPathOverridesTest(TestCase):
"""Test RequireJS path overrides. """ """Test RequireJS path overrides. """
OVERRIDES = { OVERRIDES = {
'jquery': 'js/vendor/jquery.min.js', 'jquery': 'common/js/vendor/jquery.js',
'backbone': 'common/js/vendor/backbone.js', 'backbone': 'common/js/vendor/backbone.js',
'text': 'js/vendor/text.js' 'text': 'js/vendor/text.js'
} }
...@@ -24,7 +24,7 @@ class RequireJSPathOverridesTest(TestCase): ...@@ -24,7 +24,7 @@ class RequireJSPathOverridesTest(TestCase):
"(function (require) {", "(function (require) {",
"require.config({", "require.config({",
"paths: {", "paths: {",
"'jquery': 'js/vendor/jquery.min',", "'jquery': 'common/js/vendor/jquery',",
"'text': 'js/vendor/text',", "'text': 'js/vendor/text',",
"'backbone': 'common/js/vendor/backbone'", "'backbone': 'common/js/vendor/backbone'",
"}", "}",
......
...@@ -3,6 +3,7 @@ define([ ...@@ -3,6 +3,7 @@ define([
'edx-ui-toolkit/js/utils/html-utils', 'edx-ui-toolkit/js/utils/html-utils',
'domReady!', 'domReady!',
'jquery', 'jquery',
'jquery-migrate',
'backbone', 'backbone',
'underscore', 'underscore',
'gettext' 'gettext'
......
(function(requirejs, define) { (function(requirejs, define) {
'use strict';
requirejs.config({ requirejs.config({
baseUrl: '/base/', baseUrl: '/base/',
paths: { paths: {
'gettext': 'js/test/i18n', 'gettext': 'js/test/i18n',
'jquery': 'js/vendor/jquery.min', 'jquery': 'common/js/vendor/jquery',
'jquery-migrate': 'common/js/vendor/jquery-migrate',
'jquery.ui': 'js/vendor/jquery-ui.min', 'jquery.ui': 'js/vendor/jquery-ui.min',
'jquery.flot': 'js/vendor/flot/jquery.flot.min', 'jquery.flot': 'js/vendor/flot/jquery.flot.min',
'jquery.form': 'js/vendor/jquery.form', 'jquery.form': 'js/vendor/jquery.form',
......
../../../../node_modules/jquery-migrate/dist/jquery-migrate.min.js
\ No newline at end of file
../../../../node_modules/jquery/dist/jquery.min.js
\ No newline at end of file
...@@ -1240,8 +1240,8 @@ proctoring_js = ( ...@@ -1240,8 +1240,8 @@ proctoring_js = (
# In the future, we will likely refactor this to use # In the future, we will likely refactor this to use
# RequireJS and an optimizer. # RequireJS and an optimizer.
base_vendor_js = [ base_vendor_js = [
'js/vendor/jquery.min.js', 'common/js/vendor/jquery.js',
'js/vendor/jquery-migrate.min.js', 'common/js/vendor/jquery-migrate.js',
'js/vendor/jquery.cookie.js', 'js/vendor/jquery.cookie.js',
'js/vendor/url.min.js', 'js/vendor/url.min.js',
'common/js/vendor/underscore.js', 'common/js/vendor/underscore.js',
...@@ -1353,16 +1353,16 @@ incourse_reverify_js = [ ...@@ -1353,16 +1353,16 @@ incourse_reverify_js = [
ccx_js = sorted(rooted_glob(PROJECT_ROOT / 'static', 'js/ccx/**/*.js')) ccx_js = sorted(rooted_glob(PROJECT_ROOT / 'static', 'js/ccx/**/*.js'))
certificates_web_view_js = [ certificates_web_view_js = [
'js/vendor/jquery.min.js', 'common/js/vendor/jquery.js',
'js/vendor/jquery-migrate.min.js', 'common/js/vendor/jquery-migrate.js',
'js/vendor/jquery.cookie.js', 'js/vendor/jquery.cookie.js',
'js/src/logger.js', 'js/src/logger.js',
'js/utils/facebook.js', 'js/utils/facebook.js',
] ]
credit_web_view_js = [ credit_web_view_js = [
'js/vendor/jquery.min.js', 'common/js/vendor/jquery.js',
'js/vendor/jquery-migrate.min.js', 'common/js/vendor/jquery-migrate.js',
'js/vendor/jquery.cookie.js', 'js/vendor/jquery.cookie.js',
'js/src/logger.js', 'js/src/logger.js',
] ]
......
...@@ -3,12 +3,6 @@ describe 'AutoEnrollment', -> ...@@ -3,12 +3,6 @@ describe 'AutoEnrollment', ->
loadFixtures 'coffee/fixtures/autoenrollment.html' loadFixtures 'coffee/fixtures/autoenrollment.html'
@autoenrollment = new AutoEnrollmentViaCsv $('.auto_enroll_csv') @autoenrollment = new AutoEnrollmentViaCsv $('.auto_enroll_csv')
it 'binds to the enrollment_signup_button on click event', ->
expect(@autoenrollment.$enrollment_signup_button).toHandle 'click'
it 'binds to the browse button on change event', ->
expect(@autoenrollment.$browse_button).toHandle 'change'
it 'binds the ajax call and the result will be success', -> it 'binds the ajax call and the result will be success', ->
spyOn($, "ajax").and.callFake((params) => spyOn($, "ajax").and.callFake((params) =>
params.success({row_errors: [], general_errors: [], warnings: []}) params.success({row_errors: [], general_errors: [], warnings: []})
......
...@@ -8,12 +8,8 @@ ...@@ -8,12 +8,8 @@
paths: { paths: {
'gettext': 'xmodule_js/common_static/js/test/i18n', 'gettext': 'xmodule_js/common_static/js/test/i18n',
'codemirror': 'xmodule_js/common_static/js/vendor/CodeMirror/codemirror', 'codemirror': 'xmodule_js/common_static/js/vendor/CodeMirror/codemirror',
// The jquery-migrate library was added in upgrading from 'jquery': 'xmodule_js/common_static/common/js/vendor/jquery',
// jQuery 1.7.x to 2.2.x. This config allows developers 'jquery-migrate': 'xmodule_js/common_static/common/js/vendor/jquery-migrate',
// to depend on "jquery" which opaquely requires both
// libraries.
'_jquery': 'xmodule_js/common_static/js/vendor/jquery.min',
'jquery': 'xmodule_js/common_static/js/vendor/jquery-migrate.min',
'jquery.ui': 'xmodule_js/common_static/js/vendor/jquery-ui.min', 'jquery.ui': 'xmodule_js/common_static/js/vendor/jquery-ui.min',
'jquery.eventDrag': 'xmodule_js/common_static/js/vendor/jquery.event.drag-2.2', 'jquery.eventDrag': 'xmodule_js/common_static/js/vendor/jquery.event.drag-2.2',
'jquery.flot': 'xmodule_js/common_static/js/vendor/flot/jquery.flot.min', 'jquery.flot': 'xmodule_js/common_static/js/vendor/flot/jquery.flot.min',
...@@ -124,10 +120,7 @@ ...@@ -124,10 +120,7 @@
'date': { 'date': {
exports: 'Date' exports: 'Date'
}, },
"jquery": { "jquery-migrate": ['jquery'],
deps: ["_jquery"],
exports: "jQuery"
},
'jquery.ui': { 'jquery.ui': {
deps: ['jquery'], deps: ['jquery'],
exports: 'jQuery.ui' exports: 'jQuery.ui'
......
...@@ -65,10 +65,8 @@ ...@@ -65,10 +65,8 @@
paths: { paths: {
'gettext': 'empty:', 'gettext': 'empty:',
'coffee/src/ajax_prefix': 'empty:', 'coffee/src/ajax_prefix': 'empty:',
// '_jquery' is the name of the current jQuery in the
// platform, and 'jquery' refers to jquery-migrate.
'_jquery': 'empty:',
'jquery': 'empty:', 'jquery': 'empty:',
'jquery-migrate': 'empty:',
'jquery.cookie': 'empty:', 'jquery.cookie': 'empty:',
'jquery.url': 'empty:', 'jquery.url': 'empty:',
'backbone': 'empty:', 'backbone': 'empty:',
......
...@@ -28,6 +28,7 @@ ...@@ -28,6 +28,7 @@
} }
}; };
defineDependency("jQuery", "jquery"); defineDependency("jQuery", "jquery");
defineDependency("jQuery", "jquery-migrate");
defineDependency("_", "underscore"); defineDependency("_", "underscore");
defineDependency("s", "underscore.string"); defineDependency("s", "underscore.string");
// Underscore.string no longer installs itself directly on "_". For compatibility with existing // Underscore.string no longer installs itself directly on "_". For compatibility with existing
...@@ -68,8 +69,8 @@ ...@@ -68,8 +69,8 @@
// jQuery 1.7.x to 2.2.x. This config allows developers // jQuery 1.7.x to 2.2.x. This config allows developers
// to depend on "jquery" which opaquely requires both // to depend on "jquery" which opaquely requires both
// libraries. // libraries.
"_jquery": "js/vendor/jquery.min", "jquery": "common/js/vendor/jquery",
"jquery": "js/vendor/jquery-migrate.min", "jquery-migrate": "common/js/vendor/jquery-migrate",
"jquery.cookie": "js/vendor/jquery.cookie", "jquery.cookie": "js/vendor/jquery.cookie",
'jquery.timeago': 'js/vendor/jquery.timeago', 'jquery.timeago': 'js/vendor/jquery.timeago',
"jquery.url": "js/vendor/url.min", "jquery.url": "js/vendor/url.min",
...@@ -116,13 +117,11 @@ ...@@ -116,13 +117,11 @@
"date": { "date": {
exports: "Date" exports: "Date"
}, },
<<<<<<< HEAD
=======
"jquery": { "jquery": {
deps: ["_jquery"], deps: ["_jquery"],
exports: "jQuery" exports: "jQuery"
}, },
>>>>>>> Upgrade jQuery 1.7.2 to 2.2.0 "jquery-migrate": ['jquery'],
"jquery.cookie": { "jquery.cookie": {
deps: ["jquery"], deps: ["jquery"],
exports: "jQuery.fn.cookie" exports: "jQuery.fn.cookie"
......
...@@ -21,7 +21,7 @@ ...@@ -21,7 +21,7 @@
</body> </body>
</html> </html>
<script type="text/javascript" src="${static.url('js/vendor/jquery.min.js')}"></script> <script type="text/javascript" src="${static.url('common/js/vendor/jquery.js')}"></script>
<script type="text/javascript"> <script type="text/javascript">
$(document).ready(function() { $(document).ready(function() {
......
...@@ -45,6 +45,8 @@ SASS_LOAD_PATHS = [ ...@@ -45,6 +45,8 @@ SASS_LOAD_PATHS = [
# A list of NPM installed libraries that should be copied into the common # A list of NPM installed libraries that should be copied into the common
# static directory. # static directory.
NPM_INSTALLED_LIBRARIES = [ NPM_INSTALLED_LIBRARIES = [
'jquery/dist/jquery.js',
'jquery-migrate/dist/jquery-migrate.js',
'underscore/underscore.js', 'underscore/underscore.js',
'underscore.string/dist/underscore.string.js', 'underscore.string/dist/underscore.string.js',
'picturefill/dist/picturefill.js', 'picturefill/dist/picturefill.js',
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment