diff --git a/cms/static/coffee/spec/main.coffee b/cms/static/coffee/spec/main.coffee index c5d1df72b3..73fe664d8d 100644 --- a/cms/static/coffee/spec/main.coffee +++ b/cms/static/coffee/spec/main.coffee @@ -27,9 +27,9 @@ requirejs.config({ "moment": "xmodule_js/common_static/js/vendor/moment.min", "moment-with-locales": "xmodule_js/common_static/js/vendor/moment-with-locales.min", "text": "xmodule_js/common_static/js/vendor/requirejs/text", - "underscore": "xmodule_js/common_static/common/js/vendor/underscore", - "underscore.string": "xmodule_js/common_static/common/js/vendor/underscore.string", - "backbone": "xmodule_js/common_static/common/js/vendor/backbone", + "underscore": "common/js/vendor/underscore", + "underscore.string": "common/js/vendor/underscore.string", + "backbone": "common/js/vendor/backbone", "backbone.associations": "xmodule_js/common_static/js/vendor/backbone-associations-min", "backbone.paginator": "xmodule_js/common_static/js/vendor/backbone.paginator.min", "backbone-relational": "xmodule_js/common_static/js/vendor/backbone-relational.min", @@ -44,15 +44,13 @@ requirejs.config({ "sinon": "xmodule_js/common_static/js/vendor/sinon-1.17.0", "squire": "xmodule_js/common_static/js/vendor/Squire", "jasmine-imagediff": "xmodule_js/common_static/js/vendor/jasmine-imagediff", - "jasmine-stealth": "xmodule_js/common_static/js/libs/jasmine-stealth", - "jasmine-waituntil": "xmodule_js/common_static/js/libs/jasmine-waituntil", "draggabilly": "xmodule_js/common_static/js/vendor/draggabilly", "domReady": "xmodule_js/common_static/js/vendor/domReady", "URI": "xmodule_js/common_static/js/vendor/URI.min", "mock-ajax": "xmodule_js/common_static/js/vendor/mock-ajax", - "modernizr": "xmodule_js/common_static/edx-pattern-library/js/modernizr-custom", - "afontgarde": "xmodule_js/common_static/edx-pattern-library/js/afontgarde", - "edxicons": "xmodule_js/common_static/edx-pattern-library/js/edx-icons", + "modernizr": "edx-pattern-library/js/modernizr-custom", + "afontgarde": "edx-pattern-library/js/afontgarde", + "edxicons": "edx-pattern-library/js/edx-icons", "mathjax": "//cdn.mathjax.org/mathjax/2.6-latest/MathJax.js?config=TeX-MML-AM_SVG&delayStartupUntil=configured", "youtube": "//www.youtube.com/player_api?noext", @@ -180,10 +178,13 @@ requirejs.config({ exports: "sinon" }, "jasmine-imagediff": {}, - "jasmine-stealth": { + "common/js/spec_helpers/jasmine-extensions": { + deps: ["jquery"] + }, + "common/js/spec_helpers/jasmine-stealth": { deps: ["underscore", "underscore.string"] }, - "jasmine-waituntil": { + "common/js/spec_helpers/jasmine-waituntil": { deps: ["jquery"] }, "xblock/core": { @@ -283,8 +284,14 @@ while i < testFiles.length testFiles[i] = '/base/' + testFiles[i] + '.js' i++ +specHelpers = [ + 'common/js/spec_helpers/jasmine-extensions', + 'common/js/spec_helpers/jasmine-stealth', + 'common/js/spec_helpers/jasmine-waituntil' +] + # Jasmine has a global stack for creating a tree of specs. We need to load # spec files one by one, otherwise some end up getting nested under others. -requireSerial testFiles, -> +requireSerial specHelpers.concat(testFiles), -> # start test run, once Require.js is done window.__karma__.start() diff --git a/cms/static/coffee/spec/main_spec.coffee b/cms/static/coffee/spec/main_spec.coffee index ee68e31326..39098691ea 100644 --- a/cms/static/coffee/spec/main_spec.coffee +++ b/cms/static/coffee/spec/main_spec.coffee @@ -1,5 +1,4 @@ -require ["jquery", "backbone", "coffee/src/main", "common/js/spec_helpers/ajax_helpers", - "jasmine-stealth", "jasmine-waituntil", "jquery.cookie"], +require ["jquery", "backbone", "coffee/src/main", "common/js/spec_helpers/ajax_helpers", "jquery.cookie"], ($, Backbone, main, AjaxHelpers) -> describe "CMS", -> it "should initialize URL", -> diff --git a/cms/static/coffee/spec/main_squire.coffee b/cms/static/coffee/spec/main_squire.coffee index a3480f3516..3e86a658c1 100644 --- a/cms/static/coffee/spec/main_squire.coffee +++ b/cms/static/coffee/spec/main_squire.coffee @@ -26,7 +26,7 @@ requirejs.config({ "text": "xmodule_js/common_static/js/vendor/requirejs/text", "underscore": "common/js/vendor/underscore", "underscore.string": "common/js/vendor/underscore.string", - "backbone": "xmodule_js/common_static/common/js/vendor/backbone", + "backbone": "common/js/vendor/backbone", "backbone.associations": "xmodule_js/common_static/js/vendor/backbone-associations-min", "backbone.paginator": "xmodule_js/common_static/js/vendor/backbone.paginator.min", "tinymce": "xmodule_js/common_static/js/vendor/tinymce/js/tinymce/tinymce.full.min", @@ -38,11 +38,9 @@ requirejs.config({ "utility": "xmodule_js/common_static/js/src/utility", "sinon": "xmodule_js/common_static/js/vendor/sinon-1.17.0", "squire": "xmodule_js/common_static/js/vendor/Squire", - "modernizr": "xmodule_js/common_static/edx-pattern-library/js/modernizr-custom", - "afontgarde": "xmodule_js/common_static/edx-pattern-library/js/afontgarde", - "edxicons": "xmodule_js/common_static/edx-pattern-library/js/edx-icons", - "jasmine-stealth": "xmodule_js/common_static/js/libs/jasmine-stealth", - "jasmine-waituntil": "xmodule_js/common_static/js/libs/jasmine-waituntil", + "modernizr": "edx-pattern-library/js/modernizr-custom", + "afontgarde": "edx-pattern-library/js/afontgarde", + "edxicons": "edx-pattern-library/js/edx-icons", "draggabilly": "xmodule_js/common_static/js/vendor/draggabilly", "domReady": "xmodule_js/common_static/js/vendor/domReady", "URI": "xmodule_js/common_static/js/vendor/URI.min", @@ -160,10 +158,13 @@ requirejs.config({ "sinon": { exports: "sinon" }, - "jasmine-stealth": { + "common/js/spec_helpers/jasmine-extensions": { + deps: ["jquery"] + }, + "common/js/spec_helpers/jasmine-stealth": { deps: ["underscore", "underscore.string"] }, - "jasmine-waituntil": { + "common/js/spec_helpers/jasmine-waituntil": { deps: ["jquery"] }, "xblock/core": { @@ -203,8 +204,14 @@ while i < testFiles.length testFiles[i] = '/base/' + testFiles[i] + '.js' i++ +specHelpers = [ + 'common/js/spec_helpers/jasmine-extensions', + 'common/js/spec_helpers/jasmine-stealth', + 'common/js/spec_helpers/jasmine-waituntil' +] + # Jasmine has a global stack for creating a tree of specs. We need to load # spec files one by one, otherwise some end up getting nested under others. -requireSerial testFiles, -> +requireSerial specHelpers.concat(testFiles), -> # start test run, once Require.js is done window.__karma__.start() diff --git a/cms/static/coffee/spec/views/textbook_spec.coffee b/cms/static/coffee/spec/views/textbook_spec.coffee index 01e6134d58..b2a251fb6d 100644 --- a/cms/static/coffee/spec/views/textbook_spec.coffee +++ b/cms/static/coffee/spec/views/textbook_spec.coffee @@ -2,7 +2,7 @@ define ["js/models/textbook", "js/models/chapter", "js/collections/chapter", "js "js/collections/textbook", "js/views/show_textbook", "js/views/edit_textbook", "js/views/list_textbooks", "js/views/edit_chapter", "common/js/components/views/feedback_prompt", "common/js/components/views/feedback_notification", "common/js/components/utils/view_utils","common/js/spec_helpers/ajax_helpers", - "js/spec_helpers/modal_helpers", "jasmine-stealth"], + "js/spec_helpers/modal_helpers"], (Textbook, Chapter, ChapterSet, Course, TextbookSet, ShowTextbook, EditTextbook, ListTextbooks, EditChapter, Prompt, Notification, ViewUtils, AjaxHelpers, modal_helpers) -> describe "ShowTextbook", -> diff --git a/cms/static/js/spec/views/group_configuration_spec.js b/cms/static/js/spec/views/group_configuration_spec.js index b049f2f190..db924cfb62 100644 --- a/cms/static/js/spec/views/group_configuration_spec.js +++ b/cms/static/js/spec/views/group_configuration_spec.js @@ -5,7 +5,7 @@ define([ 'js/views/group_configuration_item', 'js/views/experiment_group_edit', 'js/views/content_group_list', 'js/views/content_group_details', 'js/views/content_group_editor', 'js/views/content_group_item', 'common/js/components/views/feedback_notification', 'common/js/spec_helpers/ajax_helpers', 'common/js/spec_helpers/template_helpers', - 'common/js/spec_helpers/view_helpers', 'jasmine-stealth' + 'common/js/spec_helpers/view_helpers' ], function( _, Course, GroupConfigurationModel, GroupModel, GroupConfigurationCollection, GroupCollection, GroupConfigurationDetailsView, GroupConfigurationsListView, GroupConfigurationEditorView, diff --git a/cms/static/js_test.yml b/cms/static/js_test.yml deleted file mode 100644 index 3953a9cec5..0000000000 --- a/cms/static/js_test.yml +++ /dev/null @@ -1,115 +0,0 @@ ---- -# JavaScript test suite description -# -# -# To run all the tests and print results to the console: -# -# js-test-tool run TEST_SUITE --use-firefox -# -# where `TEST_SUITE` is this file. -# -# -# To run the tests in your default browser ("dev mode"): -# -# js-test-tool dev TEST_SUITE -# - -test_suite_name: cms - -test_runner: jasmine_requirejs - -# Path prepended to source files in the coverage report (optional) -# For example, if the source path -# is "src/source.js" (relative to this YAML file) -# and the prepend path is "base/dir" -# then the coverage report will show -# "base/dir/src/source.js" -prepend_path: cms/static - -# Paths to library JavaScript files (optional) -lib_paths: - - xmodule_js/common_static/js/vendor/requirejs/require.js - - xmodule_js/common_static/coffee/src/ajax_prefix.js - - xmodule_js/common_static/js/src/utility.js - - xmodule_js/common_static/js/vendor/jquery.min.js - - xmodule_js/common_static/js/vendor/jquery-ui.min.js - - xmodule_js/common_static/js/vendor/jquery.cookie.js - - xmodule_js/common_static/js/vendor/jquery.simulate.js - - xmodule_js/common_static/common/js/vendor/underscore.js - - xmodule_js/common_static/common/js/vendor/underscore.string.js - - xmodule_js/common_static/common/js/vendor/backbone.js - - xmodule_js/common_static/js/vendor/backbone-associations-min.js - - xmodule_js/common_static/js/vendor/backbone.paginator.min.js - - xmodule_js/common_static/js/vendor/backbone-relational.min.js - - xmodule_js/common_static/js/vendor/timepicker/jquery.timepicker.js - - xmodule_js/common_static/js/vendor/jquery.leanModal.js - - xmodule_js/common_static/js/vendor/jquery.ajaxQueue.js - - xmodule_js/common_static/js/vendor/jquery.form.js - - xmodule_js/common_static/js/vendor/html5-input-polyfills/number-polyfill.js - - xmodule_js/common_static/js/vendor/sinon-1.17.0.js - - xmodule_js/common_static/js/vendor/Squire.js - - xmodule_js/common_static/js/libs/jasmine-stealth.js - - xmodule_js/common_static/js/libs/jasmine-waituntil.js - - xmodule_js/common_static/js/vendor/jasmine-imagediff.js - - xmodule_js/common_static/js/vendor/CodeMirror/codemirror.js - - xmodule_js/common_static/js/vendor/jQuery-File-Upload/js - - xmodule_js/src/xmodule.js - - xmodule_js/common_static/js/test/i18n.js - - xmodule_js/common_static/js/vendor/draggabilly.js - - xmodule_js/common_static/js/vendor/date.js - - xmodule_js/common_static/js/vendor/domReady.js - - xmodule_js/common_static/js/vendor/URI.min.js - - xmodule_js/common_static/js/vendor/jquery.smooth-scroll.min.js - - xmodule_js/common_static/coffee/src/jquery.immediateDescendents.js - - xmodule_js/common_static/js/xblock/ - - xmodule_js/common_static/coffee/src/xblock/ - - xmodule_js/common_static/js/vendor/jQuery-File-Upload/js/jquery.iframe-transport.js - - xmodule_js/common_static/js/vendor/jQuery-File-Upload/js/jquery.fileupload.js - - xmodule_js/common_static/js/vendor/jQuery-File-Upload/js/jquery.fileupload-process.js - - xmodule_js/common_static/js/vendor/jQuery-File-Upload/js/jquery.fileupload-validate.js - - xmodule_js/common_static/js/vendor/mock-ajax.js - - xmodule_js/common_static/js/vendor/requirejs/text.js - - xmodule_js/common_static/edx-pattern-library/js/modernizr-custom.js - - xmodule_js/common_static/edx-pattern-library/js/afontgarde.js - - xmodule_js/common_static/edx-pattern-library/js/edx-icons.js - -# Paths to source JavaScript files -src_paths: - - coffee/src - - js - - js/certificates - - js/factories - - common/js - - edx-pattern-library/js - - edx-ui-toolkit/js - -# Paths to spec (test) JavaScript files -# We should define the custom path mapping in /coffee/spec/main.coffee as well e.g. certificates etc. -spec_paths: - - coffee/spec/main.js - - coffee/spec - - js/spec - - js/certificates/spec - -# Paths to fixture files (optional) -# The fixture path will be set automatically when using jasmine-jquery. -# (https://github.com/velesin/jasmine-jquery) -# -# You can then access fixtures using paths relative to -# the test suite description: -# -# loadFixtures('path/to/fixture/fixture.html'); -# -fixture_paths: - - coffee/fixtures - - templates - - common/templates - -requirejs: - paths: - main: coffee/spec/main - -# Because require.js is responsible for loading all dependencies, we exclude -# all files from being included in