Create Calculator and Feedback form on every page
This commit is contained in:
committed by
Matthew Mongeau
parent
03cc78f52e
commit
dd0c41cd15
@@ -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()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user