diff --git a/cms/static/coffee/files.json b/cms/static/coffee/files.json
index 2249813b04..e7a66b5bc0 100644
--- a/cms/static/coffee/files.json
+++ b/cms/static/coffee/files.json
@@ -1,12 +1,12 @@
{
- "js_files": [
- "/static/js/vendor/RequireJS.js",
- "/static/js/vendor/jquery.min.js",
- "/static/js/vendor/jquery-ui.min.js",
- "/static/js/vendor/jquery.ui.draggable.js",
- "/static/js/vendor/jquery.cookie.js",
- "/static/js/vendor/json2.js",
- "/static/js/vendor/underscore-min.js",
- "/static/js/vendor/backbone-min.js"
+ "static_files": [
+ "js/vendor/RequireJS.js",
+ "js/vendor/jquery.min.js",
+ "js/vendor/jquery-ui.min.js",
+ "js/vendor/jquery.ui.draggable.js",
+ "js/vendor/jquery.cookie.js",
+ "js/vendor/json2.js",
+ "js/vendor/underscore-min.js",
+ "js/vendor/backbone-min.js"
]
}
diff --git a/common/templates/jasmine/base.html b/common/templates/jasmine/base.html
index 96507bdebf..9a1b3bed92 100644
--- a/common/templates/jasmine/base.html
+++ b/common/templates/jasmine/base.html
@@ -13,14 +13,19 @@
+ {% load compressed %}
+ {# static files #}
+ {% for url in suite.static_files %}
+
+ {% endfor %}
+
+ {% compressed_js 'js-test-source' %}
+
{# source files #}
{% for url in suite.js_files %}
{% endfor %}
- {% load compressed %}
- {# static files #}
- {% compressed_js 'js-test-source' %}
{# spec files #}
{% compressed_js 'spec' %}
diff --git a/lms/static/coffee/files.json b/lms/static/coffee/files.json
index 5dc03613b9..0efe488dd9 100644
--- a/lms/static/coffee/files.json
+++ b/lms/static/coffee/files.json
@@ -5,8 +5,5 @@
"/static/js/vendor/jquery-ui.min.js",
"/static/js/vendor/jquery.leanModal.min.js",
"/static/js/vendor/flot/jquery.flot.js"
- ],
- "static_files": [
- "js/application.js"
]
}
diff --git a/lms/static/coffee/spec/calculator_spec.coffee b/lms/static/coffee/spec/calculator_spec.coffee
index 072d220a44..8258d8965a 100644
--- a/lms/static/coffee/spec/calculator_spec.coffee
+++ b/lms/static/coffee/spec/calculator_spec.coffee
@@ -4,9 +4,6 @@ describe 'Calculator', ->
@calculator = new Calculator
describe 'bind', ->
- beforeEach ->
- Calculator.bind()
-
it 'bind the calculator button', ->
expect($('.calc')).toHandleWith 'click', @calculator.toggle
@@ -31,12 +28,19 @@ describe 'Calculator', ->
$('form#calculator').submit()
describe 'toggle', ->
- it 'toggle the calculator and focus the input', ->
- spyOn $.fn, 'focus'
- @calculator.toggle(jQuery.Event("click"))
+ it 'focuses the input when toggled', ->
- expect($('li.calc-main')).toHaveClass('open')
- expect($('#calculator_wrapper #calculator_input').focus).toHaveBeenCalled()
+ # Since the focus is called asynchronously, we need to
+ # wait until focus() is called.
+ didFocus = false
+ runs ->
+ spyOn($.fn, 'focus').andCallFake (elementName) -> didFocus = true
+ @calculator.toggle(jQuery.Event("click"))
+
+ waitsFor (-> didFocus), "focus() should have been called on the input", 1000
+
+ runs ->
+ expect($('#calculator_wrapper #calculator_input').focus).toHaveBeenCalled()
it 'toggle the close button on the calculator button', ->
@calculator.toggle(jQuery.Event("click"))
diff --git a/lms/static/coffee/spec/modules/tab_spec.coffee b/lms/static/coffee/spec/modules/tab_spec.coffee
index 909f0d7cda..6fba470974 100644
--- a/lms/static/coffee/spec/modules/tab_spec.coffee
+++ b/lms/static/coffee/spec/modules/tab_spec.coffee
@@ -22,18 +22,23 @@ describe 'Tab', ->
it 'bind the tabs', ->
expect($.fn.tabs).toHaveBeenCalledWith show: @tab.onShow
+ # As of jQuery 1.9, the onShow callback is deprecated
+ # http://jqueryui.com/upgrade-guide/1.9/#deprecated-show-event-renamed-to-activate
+ # The code below tests that onShow does what is expected,
+ # but note that onShow will NOT be called when the user
+ # clicks on the tab if we're using jQuery version >= 1.9
describe 'onShow', ->
beforeEach ->
@tab = new Tab 1, @items
- $('[href="#tab-1-0"]').click()
+ @tab.onShow($('#tab-1-0'), {'index': 1})
it 'replace content in the container', ->
- $('[href="#tab-1-1"]').click()
+ @tab.onShow($('#tab-1-1'), {'index': 1})
expect($('#tab-1-0').html()).toEqual ''
expect($('#tab-1-1').html()).toEqual 'Video 2'
expect($('#tab-1-2').html()).toEqual ''
it 'trigger contentChanged event on the element', ->
spyOnEvent @tab.el, 'contentChanged'
- $('[href="#tab-1-1"]').click()
+ @tab.onShow($('#tab-1-1'), {'index': 1})
expect('contentChanged').toHaveBeenTriggeredOn @tab.el
diff --git a/lms/static/coffee/spec/navigation_spec.coffee b/lms/static/coffee/spec/navigation_spec.coffee
index 1340984e52..b351164b63 100644
--- a/lms/static/coffee/spec/navigation_spec.coffee
+++ b/lms/static/coffee/spec/navigation_spec.coffee
@@ -32,11 +32,9 @@ describe 'Navigation', ->
heightStyle: 'content'
it 'binds the accordionchange event', ->
- Navigation.bind()
expect($('#accordion')).toHandleWith 'accordionchange', @navigation.log
it 'bind the navigation toggle', ->
- Navigation.bind()
expect($('#open_close_accordion a')).toHandleWith 'click', @navigation.toggle
describe 'when the #accordion does not exists', ->
@@ -45,7 +43,6 @@ describe 'Navigation', ->
it 'does not activate the accordion', ->
spyOn $.fn, 'accordion'
- Navigation.bind()
expect($('#accordion').accordion).wasNotCalled()
describe 'toggle', ->