From 1de194aaa453b3e062f503cff0e9e2694b667975 Mon Sep 17 00:00:00 2001 From: cahrens Date: Mon, 7 Oct 2013 17:17:31 -0400 Subject: [PATCH] Use RequireJS for test dependencies, and use domReady. --- cms/static/coffee/spec/main.coffee | 1 + cms/static/coffee/spec/views/overview_spec.coffee | 7 +------ cms/static/js/views/overview.js | 6 +++--- cms/static/js_test.yml | 3 +++ 4 files changed, 8 insertions(+), 9 deletions(-) diff --git a/cms/static/coffee/spec/main.coffee b/cms/static/coffee/spec/main.coffee index bffa49052d..b23e7255fd 100644 --- a/cms/static/coffee/spec/main.coffee +++ b/cms/static/coffee/spec/main.coffee @@ -33,6 +33,7 @@ requirejs.config({ "jasmine-stealth": "xmodule_js/common_static/js/vendor/jasmine-stealth", "jasmine.async": "xmodule_js/common_static/js/vendor/jasmine.async", "draggabilly": "xmodule_js/common_static/js/vendor/draggabilly.pkgd", + "domReady": "xmodule_js/common_static/js/vendor/domReady", "coffee/src/ajax_prefix": "xmodule_js/common_static/coffee/src/ajax_prefix" } diff --git a/cms/static/coffee/spec/views/overview_spec.coffee b/cms/static/coffee/spec/views/overview_spec.coffee index 3ca0504cca..0406ff59c5 100644 --- a/cms/static/coffee/spec/views/overview_spec.coffee +++ b/cms/static/coffee/spec/views/overview_spec.coffee @@ -1,13 +1,8 @@ -define ["js/views/overview", "js/views/feedback_notification", "sinon", "js/base"], +define ["js/views/overview", "js/views/feedback_notification", "sinon", "js/base", "date", "jquery.timepicker"], (OverviewDragger, Notification, sinon) -> describe "Course Overview", -> beforeEach -> - _.each ["/static/js/vendor/date.js", "/static/js/vendor/timepicker/jquery.timepicker.js", "/jsi18n/", "/static/js/vendor/draggabilly.pkgd.js"], (path) -> - appendSetFixtures """ - - """ - appendSetFixtures """
diff --git a/cms/static/js/views/overview.js b/cms/static/js/views/overview.js index c7902028e3..ea4a55e158 100644 --- a/cms/static/js/views/overview.js +++ b/cms/static/js/views/overview.js @@ -1,5 +1,5 @@ -define(["jquery", "jquery.ui", "gettext", "js/views/feedback_notification", "draggabilly"], - function ($, ui, gettext, NotificationView, Draggabilly) { +define(["domReady", "jquery", "jquery.ui", "gettext", "js/views/feedback_notification", "draggabilly"], + function (domReady, $, ui, gettext, NotificationView, Draggabilly) { var overviewDragger = { droppableClasses: 'drop-target drop-target-prepend drop-target-before drop-target-after', @@ -294,7 +294,7 @@ define(["jquery", "jquery.ui", "gettext", "js/views/feedback_notification", "dra } }; - $(document).ready(function () { + domReady(function() { // Section overviewDragger.makeDraggable( '.courseware-section', diff --git a/cms/static/js_test.yml b/cms/static/js_test.yml index 989441fdb6..c76481116e 100644 --- a/cms/static/js_test.yml +++ b/cms/static/js_test.yml @@ -52,6 +52,9 @@ lib_paths: - xmodule_js/src/xmodule.js - xmodule_js/common_static/js/test/i18n.js - xmodule_js/common_static/js/vendor/draggabilly.pkgd.js + - xmodule_js/common_static/js/vendor/date.js + - xmodule_js/common_static/js/vendor/domReady.js + - xmodule_js/common_static/js/vendor/jquery.smooth-scroll.min.js # Paths to source JavaScript files src_paths: