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 | |
parent | 32d3ec6c059bc4fbb9ab7cc49dfe926bdaadf482 (diff) |
#442 Creates feedback sender component.
Diffstat (limited to 'web-ui/test/spec/mail_view')
-rw-r--r-- | web-ui/test/spec/mail_view/data/feedback_sender.spec.js | 27 | ||||
-rw-r--r-- | web-ui/test/spec/mail_view/ui/feedback_box.spec.js | 6 |
2 files changed, 30 insertions, 3 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); + }); + +}); diff --git a/web-ui/test/spec/mail_view/ui/feedback_box.spec.js b/web-ui/test/spec/mail_view/ui/feedback_box.spec.js index a034b028..f0d55791 100644 --- a/web-ui/test/spec/mail_view/ui/feedback_box.spec.js +++ b/web-ui/test/spec/mail_view/ui/feedback_box.spec.js @@ -21,10 +21,10 @@ describeComponent('mail_view/ui/feedback_box', function () { it('should fire submit feedback event', function () { var spy = spyOnEvent(document, Pixelated.events.feedback.submit); - this.component.select("textBox").val("Pixelated is Awesome!"); + this.component.select('textBox').val('Pixelated is Awesome!'); this.component.select('submitButton').click(); - expect(spy).toHaveBeenTriggeredOnAndWith(document, {feedback: "Pixelated is Awesome!"}); - }) + expect(spy).toHaveBeenTriggeredOnAndWith(document, {feedback: 'Pixelated is Awesome!'}); + }); it('should close feedback box after submit', function() { var spy = spyOnEvent(document, Pixelated.events.dispatchers.rightPane.openNoMessageSelected); |