Merge pull request #1681 from MITx/fix/will/fix_broken_jasmine_lms_tests
Fix/will/fix broken jasmine lms tests
This commit is contained in:
@@ -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"
|
||||
]
|
||||
}
|
||||
|
||||
@@ -13,14 +13,19 @@
|
||||
<script src="{% static 'js/vendor/jasmine-jquery.js' %}"></script>
|
||||
<script src="{% static 'console-runner.js' %}"></script>
|
||||
|
||||
{% load compressed %}
|
||||
{# static files #}
|
||||
{% for url in suite.static_files %}
|
||||
<script src="{{ STATIC_URL }}{{ url }}"></script>
|
||||
{% endfor %}
|
||||
|
||||
{% compressed_js 'js-test-source' %}
|
||||
|
||||
{# source files #}
|
||||
{% for url in suite.js_files %}
|
||||
<script src="{{ url }}"></script>
|
||||
{% endfor %}
|
||||
|
||||
{% load compressed %}
|
||||
{# static files #}
|
||||
{% compressed_js 'js-test-source' %}
|
||||
|
||||
{# spec files #}
|
||||
{% compressed_js 'spec' %}
|
||||
|
||||
@@ -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"
|
||||
]
|
||||
}
|
||||
|
||||
@@ -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"))
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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', ->
|
||||
|
||||
Reference in New Issue
Block a user