summaryrefslogtreecommitdiff
path: root/web-ui
diff options
context:
space:
mode:
authorVictor Shyba <victor.shyba@gmail.com>2016-01-29 14:52:08 -0300
committerVictor Shyba <victor.shyba@gmail.com>2016-01-29 14:52:08 -0300
commit5775ac239f4d9a7556bd1a3fa07c72cef175bb85 (patch)
tree46ed71fc37d6afe51cfb9cb2879ced4881fc3f94 /web-ui
parente92c87f7500d0543cb95ab007046b9c91ba1a763 (diff)
Refactoring tests.
Issue #550
Diffstat (limited to 'web-ui')
-rw-r--r--web-ui/test/spec/mail_view/ui/attachment_list.spec.js33
1 files changed, 21 insertions, 12 deletions
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 () {