From 7b9103387f9c0405cb19f6b1add8972a804bfbd8 Mon Sep 17 00:00:00 2001 From: Folker Bernitt Date: Mon, 1 Feb 2016 10:54:43 +0100 Subject: Check exactly at border limit of one megabyte - Issue #550 - Deleted skipped test --- .../test/spec/mail_view/ui/attachment_list.spec.js | 22 ++++------------------ 1 file changed, 4 insertions(+), 18 deletions(-) (limited to 'web-ui/test/spec/mail_view') 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 d0133bc5..20f82704 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 @@ -40,9 +40,10 @@ describeMixin('mail_view/ui/attachment_list', function () { }); describe('Upload files -- max file size -- ', function (){ + var ONE_MEGABYTE = 1024*1024; var submitFile = 'file not submitted', submitted = 'file submitted'; var mockSubmit = function (){ submitFile = submitted; }; - var largeAttachment = {originalFiles: [{size: 4500000}], submit: mockSubmit}; + var largeAttachment = {originalFiles: [{size: ONE_MEGABYTE+1}], submit: mockSubmit}; var dummyEvent = 'whatever, not used'; it('should show error messages on the dom, when uploading files larger than 1MB', function () { @@ -85,27 +86,12 @@ describeMixin('mail_view/ui/attachment_list', function () { expect(largeAttachment.submit).not.toHaveBeenCalled(); }); - it('should upload files smaller than 1MB', function () { - var smallAttachment = {originalFiles: [{size: 450}], submit: mockSubmit}; + it('should upload files less or equal 1MB', function () { + var smallAttachment = {originalFiles: [{size: ONE_MEGABYTE}], submit: mockSubmit}; this.component.checkAttachmentSize(dummyEvent, smallAttachment); expect(submitFile).toEqual(submitted); }); }); - - xit('should start uploading attachments', function () { - var stubAttachment = {ident: 'faked', name: 'haha.txt', size: 4500}; - var mockAjax = spyOn($, 'ajax').and.callFake(function (params) {params.success(stubAttachment);}); - var uploadedAttachment = spyOnEvent(document, Pixelated.events.mail.uploadedAttachment); - var uploading = spyOnEvent(document, Pixelated.events.mail.uploadingAttachment); - - $(document).trigger(Pixelated.events.mail.startUploadAttachment); - - expect(mockAjax).toHaveBeenCalled(); - expect(uploadedAttachment).toHaveBeenTriggeredOnAndWith(document, stubAttachment); - expect(uploading).toHaveBeenTriggeredOn(document); - }); - }); - }); -- cgit v1.2.3