summaryrefslogtreecommitdiff
path: root/web-ui/test/spec/mail_view/ui/feedback_box.spec.js
blob: ab41c7d1e82059650ab527d39cf3e374f5a32f65 (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
28
29
30
31
32
33
describeComponent('mail_view/ui/feedback_box', function () {
  'use strict';
  beforeEach(function () {
    Pixelated.mockBloodhound();
    this.setupComponent('<div></div>');
  });


  describe('close button behavior', function() {

    it('should fire Show no message selected if the close button is clicked', function() {
      var spy = spyOnEvent(document, Pixelated.events.dispatchers.rightPane.openNoMessageSelected);
      this.component.select('closeButton').click();
      expect(spy).toHaveBeenTriggeredOn(document);
    });

  });

  describe('when submit feedback', function () {
    it('should display submitted message', function() {
      var spy = spyOnEvent(document, Pixelated.events.ui.userAlerts.displayMessage);
      this.component.select('submitButton').click();
      expect(spy).toHaveBeenTriggeredOnAndWith(document, { message: 'Thanks for your feedback!' });
    });

    it('should close feedback box after submit', function() {
      var spy = spyOnEvent(document, Pixelated.events.dispatchers.rightPane.openNoMessageSelected);
      this.component.select('submitButton').click();
      expect(spy).toHaveBeenTriggeredOn(document);
    });
  });

});