diff options
author | Victor Shyba <victor.shyba@gmail.com> | 2016-01-29 15:11:45 -0300 |
---|---|---|
committer | Victor Shyba <victor.shyba@gmail.com> | 2016-01-29 15:11:45 -0300 |
commit | 451b2fbf67780c49afc609b584f4de71ce7d913b (patch) | |
tree | 66a7eaea8fd3b3afde5a2f984e86bbc485d8bc90 | |
parent | 5775ac239f4d9a7556bd1a3fa07c72cef175bb85 (diff) |
Testing Choose another file and dismiss buttons.
Issue #550
-rw-r--r-- | web-ui/app/js/mail_view/ui/attachment_list.js | 2 | ||||
-rw-r--r-- | web-ui/test/spec/mail_view/ui/attachment_list.spec.js | 24 |
2 files changed, 24 insertions, 2 deletions
diff --git a/web-ui/app/js/mail_view/ui/attachment_list.js b/web-ui/app/js/mail_view/ui/attachment_list.js index 9a5fd3a9..eb515865 100644 --- a/web-ui/app/js/mail_view/ui/attachment_list.js +++ b/web-ui/app/js/mail_view/ui/attachment_list.js @@ -86,7 +86,7 @@ define( var uploadAnotherFile = function (event) { event.preventDefault(); - self.startUpload(); + self.trigger(document, events.mail.startUploadAttachment); }; var ONE_MEGABYTE = 1000000; diff --git a/web-ui/test/spec/mail_view/ui/attachment_list.spec.js b/web-ui/test/spec/mail_view/ui/attachment_list.spec.js index a98267b1..d0133bc5 100644 --- a/web-ui/test/spec/mail_view/ui/attachment_list.spec.js +++ b/web-ui/test/spec/mail_view/ui/attachment_list.spec.js @@ -51,8 +51,30 @@ describeMixin('mail_view/ui/attachment_list', function () { expect(this.component.select('uploadError').html()).toContain('Upload failed. This file exceeds the 1MB limit.'); }); - xit('should dismiss upload failed message when clicking close icon', function () { + it('should dismiss upload failed message when clicking close icon', function () { + this.component.checkAttachmentSize(dummyEvent, largeAttachment); + + this.component.select('closeIcon').click(); + + expect(this.component.select('uploadError').html()).toBe(undefined); + }); + + it('should dismiss upload failed message when clicking dismiss button', function () { + this.component.checkAttachmentSize(dummyEvent, largeAttachment); + + this.component.select('dismissButton').click(); + + expect(this.component.select('uploadError').html()).toBe(undefined); + }); + + it('should start file upload when clicking Choose another file button', function () { + this.component.checkAttachmentSize(dummyEvent, largeAttachment); + + var triggerUploadAttachment = spyOnEvent(document, Pixelated.events.mail.startUploadAttachment); + + this.component.select('uploadFileButton').click(); + expect(triggerUploadAttachment).toHaveBeenTriggeredOn(document); }); it('should not upload files larger than 1MB', function () { |