summaryrefslogtreecommitdiff
path: root/web-ui/test/spec/mail_view/data/attachment_list.spec.js
blob: 74c1dea7fdd681b71eb7da51a3e948febe77a3f6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
describeMixin('mail_view/data/attachment_list', function () {
  'use strict';

    describe('initialization', function() {
        beforeEach(function(){
            this.setupComponent();
        });

        it('should add attachment to the list based on uploadedAttachment event', function () {
            var stubAttachment = {attachment_id: 'faked'};
            $(document).trigger(Pixelated.events.mail.uploadedAttachment, stubAttachment);
            expect(this.component.attr.attachments).toEqual([stubAttachment]);

            var anotherStubAttachment = {attachment_id: 'faked 2'};
            $(document).trigger(Pixelated.events.mail.uploadedAttachment, anotherStubAttachment);
            expect(this.component.attr.attachments).toEqual([stubAttachment, anotherStubAttachment]);
        });

    });

});