Commit 20b04c9b by Will Daly

Fixed broken calculator test in lms coffee scripts

parent 7806acc7
......@@ -31,11 +31,18 @@ describe 'Calculator', ->
$('form#calculator').submit()
describe 'toggle', ->
it 'toggle the calculator and focus the input', ->
spyOn $.fn, 'focus'
it 'focuses the input when toggled', ->
# 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"))
expect($('li.calc-main')).toHaveClass('open')
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', ->
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment