Commit 50fd135c by Christina Roberts

Merge pull request #10193 from edx/christina/move-require-test

Clean up of common JS specs using RequireJS.
parents 3e5ad298 b67f07af
...@@ -162,7 +162,8 @@ ...@@ -162,7 +162,8 @@
'common-requirejs/include/common/js/spec/components/paging_header_spec.js', 'common-requirejs/include/common/js/spec/components/paging_header_spec.js',
'common-requirejs/include/common/js/spec/components/paging_footer_spec.js', 'common-requirejs/include/common/js/spec/components/paging_footer_spec.js',
'common-requirejs/include/common/js/spec/components/search_field_spec.js', 'common-requirejs/include/common/js/spec/components/search_field_spec.js',
'common-requirejs/include/common/js/spec/components/view_utils_spec.js' 'common-requirejs/include/common/js/spec/components/view_utils_spec.js',
'common-requirejs/include/common/js/spec/utils/edx.utils.validate_spec.js'
]); ]);
}).call(this, requirejs, define); }).call(this, requirejs, define);
;(function (define) { ;(function (define) {
'use strict'; 'use strict';
define(['jquery', 'js/utils/edx.utils.validate'], define(['jquery', 'common/js/utils/edx.utils.validate'],
function($) { function($, EdxUtilsValidate) {
describe("EdxUtilsValidate", function() {
var fixture = null, var fixture = null,
field = null, field = null,
result = null, result = null,
...@@ -31,12 +32,12 @@ ...@@ -31,12 +32,12 @@
}; };
var expectValid = function() { var expectValid = function() {
result = edx.utils.validate(field); result = EdxUtilsValidate.validate(field);
expect(result.isValid).toBe(true); expect(result.isValid).toBe(true);
}; };
var expectInvalid = function( errorFragment ) { var expectInvalid = function( errorFragment ) {
result = edx.utils.validate(field); result = EdxUtilsValidate.validate(field);
expect(result.isValid).toBe(false); expect(result.isValid).toBe(false);
expect(result.message).toMatch(errorFragment); expect(result.message).toMatch(errorFragment);
}; };
...@@ -192,4 +193,5 @@ ...@@ -192,4 +193,5 @@
expectInvalid(CUSTOM_MESSAGE); expectInvalid(CUSTOM_MESSAGE);
}); });
}); });
});
}).call(this, define || RequireJS.define); }).call(this, define || RequireJS.define);
...@@ -48,7 +48,6 @@ src_paths: ...@@ -48,7 +48,6 @@ src_paths:
- js/xblock - js/xblock
- coffee/src - coffee/src
- js/src - js/src
- js/utils
- js/capa/src - js/capa/src
# Paths to spec (test) JavaScript files # Paths to spec (test) JavaScript files
......
...@@ -54,7 +54,6 @@ src_paths: ...@@ -54,7 +54,6 @@ src_paths:
# Paths to spec (test) JavaScript files # Paths to spec (test) JavaScript files
spec_paths: spec_paths:
- common/js/spec - common/js/spec
- js/spec/main_requirejs.js
# Paths to fixture files (optional) # Paths to fixture files (optional)
# The fixture path will be set automatically when using jasmine-jquery. # The fixture path will be set automatically when using jasmine-jquery.
...@@ -70,7 +69,7 @@ fixture_paths: ...@@ -70,7 +69,7 @@ fixture_paths:
requirejs: requirejs:
paths: paths:
main: js/spec/main_requirejs main: common/js/spec/main_requirejs
# Because require.js is responsible for loading all dependencies, we exclude # Because require.js is responsible for loading all dependencies, we exclude
# all files from being included in <script> tags # all files from being included in <script> tags
......
...@@ -89,7 +89,7 @@ ...@@ -89,7 +89,7 @@
'annotator_1.2.9': 'xmodule_js/common_static/js/vendor/edxnotes/annotator-full.min', 'annotator_1.2.9': 'xmodule_js/common_static/js/vendor/edxnotes/annotator-full.min',
// Common edx utils // Common edx utils
'js/utils/edx.utils.validate': 'xmodule_js/common_static/js/utils/edx.utils.validate' 'common/js/utils/edx.utils.validate': 'xmodule_js/common_static/common/js/utils/edx.utils.validate'
}, },
shim: { shim: {
'gettext': { 'gettext': {
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
'jquery', 'jquery',
'underscore', 'underscore',
'backbone', 'backbone',
'js/utils/edx.utils.validate' 'common/js/utils/edx.utils.validate'
], ],
function($, _, Backbone, EdxUtilsValidate) { function($, _, Backbone, EdxUtilsValidate) {
......
...@@ -64,7 +64,7 @@ lib_paths: ...@@ -64,7 +64,7 @@ lib_paths:
- xmodule_js/common_static/js/vendor/date.js - xmodule_js/common_static/js/vendor/date.js
- xmodule_js/common_static/js/vendor/moment.min.js - xmodule_js/common_static/js/vendor/moment.min.js
- xmodule_js/common_static/js/vendor/moment-with-locales.min.js - xmodule_js/common_static/js/vendor/moment-with-locales.min.js
- xmodule_js/common_static/js/utils/edx.utils.validate.js - xmodule_js/common_static/common/js/utils/edx.utils.validate.js
# Paths to source JavaScript files # Paths to source JavaScript files
src_paths: src_paths:
......
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