From 451b2fbf67780c49afc609b584f4de71ce7d913b Mon Sep 17 00:00:00 2001 From: Victor Shyba Date: Fri, 29 Jan 2016 15:11:45 -0300 Subject: Testing Choose another file and dismiss buttons. Issue #550 --- web-ui/app/js/mail_view/ui/attachment_list.js | 2 +- .../test/spec/mail_view/ui/attachment_list.spec.js | 24 +++++++++++++++++++++- 2 files changed, 24 insertions(+), 2 deletions(-) (limited to 'web-ui') 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 () { -- cgit v1.2.3