Files
edx-platform/lms/static/coffee/spec/feedback_form_spec.coffee
cahrens 665f983c99 Tweak focus/blur functions for JQuery upgrade.
Fix incorrectly scoped selector.
2016-05-24 16:53:42 -04:00

26 lines
851 B
CoffeeScript

describe 'FeedbackForm', ->
beforeEach ->
loadFixtures 'coffee/fixtures/feedback_form.html'
describe 'constructor', ->
beforeEach ->
new FeedbackForm
spyOn($, 'postWithPrefix').and.callFake (url, data, callback, format) ->
callback()
it 'post data to /send_feedback on click', ->
$('#feedback_subject').val 'Awesome!'
$('#feedback_message').val 'This site is really good.'
$('#feedback_button').click()
expect($.postWithPrefix).toHaveBeenCalledWith '/send_feedback', {
subject: 'Awesome!'
message: 'This site is really good.'
url: window.location.href
}, jasmine.any(Function), 'json'
it 'replace the form with a thank you message', ->
$('#feedback_button').click()
expect($('#feedback_div').html()).toEqual 'Feedback submitted. Thank you'