diff options
Diffstat (limited to 'web-ui/test/spec/mail_view')
-rw-r--r-- | web-ui/test/spec/mail_view/data/attachment_list.spec.js | 21 | ||||
-rw-r--r-- | web-ui/test/spec/mail_view/data/mail_builder.spec.js | 8 | ||||
-rw-r--r-- | web-ui/test/spec/mail_view/ui/attachment.spec.js | 24 |
3 files changed, 50 insertions, 3 deletions
diff --git a/web-ui/test/spec/mail_view/data/attachment_list.spec.js b/web-ui/test/spec/mail_view/data/attachment_list.spec.js new file mode 100644 index 00000000..74c1dea7 --- /dev/null +++ b/web-ui/test/spec/mail_view/data/attachment_list.spec.js @@ -0,0 +1,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]); + }); + + }); + +}); diff --git a/web-ui/test/spec/mail_view/data/mail_builder.spec.js b/web-ui/test/spec/mail_view/data/mail_builder.spec.js index 7f69098f..7ba860f4 100644 --- a/web-ui/test/spec/mail_view/data/mail_builder.spec.js +++ b/web-ui/test/spec/mail_view/data/mail_builder.spec.js @@ -106,5 +106,13 @@ define(['mail_view/data/mail_builder'], function (mailBuilder) { expect(mail.tags).toContain('tag1'); }); + + it('sets attachments', function() { + var mail = mailBuilder.newMail() + .attachment(['faked attachment list']) + .build(); + + expect(mail.attachments).toEqual(['faked attachment list']); + }); }); }); diff --git a/web-ui/test/spec/mail_view/ui/attachment.spec.js b/web-ui/test/spec/mail_view/ui/attachment.spec.js index 5d14f860..bbea2f55 100644 --- a/web-ui/test/spec/mail_view/ui/attachment.spec.js +++ b/web-ui/test/spec/mail_view/ui/attachment.spec.js @@ -1,3 +1,21 @@ -/** - * Created by mnandri on 12/15/15. - */ +describeComponent('mail_view/ui/attachment', function () { + 'use strict'; + + describe('attachment', function () { + beforeEach(function () { + Pixelated.mockBloodhound(); + this.setupComponent(); + }); + + it('render attachment button if feature enabled', function () { + expect(this.$node.html()).toMatch('<i class="fa fa-paperclip fa-2x"></i>'); + }); + + xit('uploads attachment on click', function () { + var fileUploads = spyOn($, 'fileupload'); + this.$node.click(); + expect(fileUploads).toHaveBeenCalled(); + }); + + }); +}); |