diff options
author | Giovane <giovaneliberato@gmail.com> | 2015-09-18 14:15:32 -0300 |
---|---|---|
committer | Giovane <giovaneliberato@gmail.com> | 2015-09-18 14:18:12 -0300 |
commit | 118a74b183807d5ed2cbda639aee5c2a4e5f8712 (patch) | |
tree | 005145cd0bb33dc4bbc90aba95d018736a1833f9 /web-ui/test/spec/mail_view/data | |
parent | 32d3ec6c059bc4fbb9ab7cc49dfe926bdaadf482 (diff) |
#442 Creates feedback sender component.
Diffstat (limited to 'web-ui/test/spec/mail_view/data')
-rw-r--r-- | web-ui/test/spec/mail_view/data/feedback_sender.spec.js | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/web-ui/test/spec/mail_view/data/feedback_sender.spec.js b/web-ui/test/spec/mail_view/data/feedback_sender.spec.js new file mode 100644 index 00000000..30952c3f --- /dev/null +++ b/web-ui/test/spec/mail_view/data/feedback_sender.spec.js @@ -0,0 +1,27 @@ +describeComponent('mail_view/data/feedback_sender', function () { + 'use strict'; + + + beforeEach(function () { + this.setupComponent(); + }); + + it('sends feedback with a POST to the server', function() { + var data = {feedback: 'Pixelated is awesome!'}; + var feedbackSubmittedEventSpy = spyOnEvent(document, Pixelated.events.feedback.submitted); + var deferred = $.Deferred(); + + spyOn($, 'ajax').and.returnValue(deferred); + + this.component.trigger(document, Pixelated.events.feedback.submit, data); + + deferred.resolve(); + + expect(feedbackSubmittedEventSpy).toHaveBeenTriggeredOn(document); + + expect($.ajax.calls.mostRecent().args[0]).toEqual('/feedback'); + expect($.ajax.calls.mostRecent().args[1].type).toEqual('POST'); + expect(JSON.parse($.ajax.calls.mostRecent().args[1].data)).toEqual(data); + }); + +}); |