Use RequireJS for test dependencies, and use domReady.

This commit is contained in:
cahrens
2013-10-07 17:17:31 -04:00
parent 328640452f
commit 1de194aaa4
4 changed files with 8 additions and 9 deletions

View File

@@ -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"
}

View File

@@ -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 """
<script type="text/javascript" src="#{path}"></script>
"""
appendSetFixtures """
<div class="section-published-date">
<span class="published-status">

View File

@@ -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',

View File

@@ -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: