From 5775ac239f4d9a7556bd1a3fa07c72cef175bb85 Mon Sep 17 00:00:00 2001 From: Victor Shyba Date: Fri, 29 Jan 2016 14:52:08 -0300 Subject: Refactoring tests. Issue #550 --- .../test/spec/mail_view/ui/attachment_list.spec.js | 33 ++++++++++++++-------- 1 file changed, 21 insertions(+), 12 deletions(-) (limited to 'web-ui') 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 9f14031e..a98267b1 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 @@ -39,27 +39,36 @@ describeMixin('mail_view/ui/attachment_list', function () { expect(this.component.select('attachmentListItem').html()).toContain('(4.39 Kb'); }); - it('should not upload files larger than 1MB', function () { + describe('Upload files -- max file size -- ', function (){ var submitFile = 'file not submitted', submitted = 'file submitted'; var mockSubmit = function (){ submitFile = submitted; }; var largeAttachment = {originalFiles: [{size: 4500000}], submit: mockSubmit}; - spyOn(largeAttachment, 'submit'); var dummyEvent = 'whatever, not used'; - this.component.checkAttachmentSize(dummyEvent, largeAttachment); + it('should show error messages on the dom, when uploading files larger than 1MB', function () { + this.component.checkAttachmentSize(dummyEvent, largeAttachment); - expect(largeAttachment.submit).not.toHaveBeenCalled(); - }); + expect(this.component.select('uploadError').html()).toContain('Upload failed. This file exceeds the 1MB limit.'); + }); - it('should upload files smaller than 1MB', function () { - var submitFile = 'file not submitted', submitted = 'file submitted'; - var mockSubmit = function (){ submitFile = submitted; }; - var largeAttachment = {originalFiles: [{size: 450}], submit: mockSubmit}; - var dummyEvent = 'whatever, not used'; + xit('should dismiss upload failed message when clicking close icon', function () { + + }); + + it('should not upload files larger than 1MB', function () { + spyOn(largeAttachment, 'submit'); + + this.component.checkAttachmentSize(dummyEvent, largeAttachment); + + expect(largeAttachment.submit).not.toHaveBeenCalled(); + }); - this.component.checkAttachmentSize(dummyEvent, largeAttachment); + it('should upload files smaller than 1MB', function () { + var smallAttachment = {originalFiles: [{size: 450}], submit: mockSubmit}; + this.component.checkAttachmentSize(dummyEvent, smallAttachment); - expect(submitFile).toEqual(submitted); + expect(submitFile).toEqual(submitted); + }); }); xit('should start uploading attachments', function () { -- cgit v1.2.3