blob: 30952c3fe05ab7d6986e9581b10210eb6c29e62d (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
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);
});
});
|