summaryrefslogtreecommitdiff
path: root/web-ui/test/spec/mail_list/ui/mail_items/draft_item.spec.js
blob: fbe285c6f581e1ff1612f834d667baacd19bab6b (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
describeComponent('mail_list/ui/mail_items/draft_item', function () {
  'use strict';

  var mail;

  beforeEach(function () {
    mail = Pixelated.testData().parsedMail.draft;

    this.setupComponent('<li></li>', {
      mail: mail,
      selected: false,
      templateType: 'single'
    });
  });

  it('should de-select the item if a new mail is composed', function () {
    this.component.$node.addClass('selected');

    $(document).trigger(Pixelated.events.ui.composeBox.newMessage);

    expect(this.component.$node).not.toHaveClass('selected');
  });

  it('should trigger the openDraft event when clicked', function () {
    var openDraftEvent = spyOnEvent(document, Pixelated.events.dispatchers.rightPane.openDraft);

    this.$node.find('a').click();

    expect(openDraftEvent).toHaveBeenTriggeredOnAndWith(document, { ident: 'B2432' });
  });
});