summaryrefslogtreecommitdiff
path: root/web-ui/test/spec
diff options
context:
space:
mode:
Diffstat (limited to 'web-ui/test/spec')
-rw-r--r--web-ui/test/spec/mail_view/data/feedback_sender.spec.js27
-rw-r--r--web-ui/test/spec/mail_view/ui/feedback_box.spec.js6
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);