Commit 64b4a4a0 by Prem Sichanugrist Committed by Matthew Mongeau

Create Calculator and Feedback form on every page

parent 062232e7
......@@ -33,16 +33,16 @@ describe 'Calculator', ->
describe 'toggle', ->
it 'toggle the calculator and focus the input', ->
spyOn $.fn, 'focus'
@calculator.toggle()
@calculator.toggle(jQuery.Event("click"))
expect($('li.calc-main')).toHaveClass('open')
expect($('#calculator_wrapper #calculator_input').focus).toHaveBeenCalled()
it 'toggle the close button on the calculator button', ->
@calculator.toggle()
@calculator.toggle(jQuery.Event("click"))
expect($('.calc')).toHaveClass('closed')
@calculator.toggle()
@calculator.toggle(jQuery.Event("click"))
expect($('.calc')).not.toHaveClass('closed')
describe 'helpToggle', ->
......
......@@ -5,16 +5,6 @@ describe 'Courseware', ->
Courseware.start()
expect(window.Navigation).toHaveBeenCalled()
it 'create the calculator', ->
spyOn(window, 'Calculator')
Courseware.start()
expect(window.Calculator).toHaveBeenCalled()
it 'creates the FeedbackForm', ->
spyOn(window, 'FeedbackForm')
Courseware.start()
expect(window.FeedbackForm).toHaveBeenCalled()
it 'binds the Logger', ->
spyOn(Logger, 'bind')
Courseware.start()
......
......@@ -6,7 +6,8 @@ class @Calculator
$('div.help-wrapper a').hover(@helpToggle).click (e) ->
e.preventDefault()
toggle: ->
toggle: (event) ->
event.preventDefault()
$('li.calc-main').toggleClass 'open'
$('#calculator_wrapper #calculator_input').focus()
if $('.calc.closed').length
......
......@@ -4,8 +4,6 @@ class @Courseware
constructor: ->
Courseware.prefix = $("meta[name='path_prefix']").attr('content')
new Navigation
new Calculator
new FeedbackForm
Logger.bind()
@bind()
@render()
......
......@@ -17,6 +17,8 @@ $ ->
# $("a[rel*=leanModal]").leanModal()
$('#csrfmiddlewaretoken').attr 'value', $.cookie('csrftoken')
new Calculator
new FeedbackForm
if $('body').hasClass('courseware')
Courseware.start()
......
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