From 731fcb8ecb68bb7519c2c9e9dee00624d19813e5 Mon Sep 17 00:00:00 2001 From: Scott Nonnenberg Date: Tue, 9 May 2017 14:28:21 -0700 Subject: [PATCH] Add test verifying that AttachmentView shows file size FREEBIE --- test/index.html | 7 +++++-- test/views/attachment_view_test.js | 19 +++++++++++++++++-- 2 files changed, 22 insertions(+), 4 deletions(-) diff --git a/test/index.html b/test/index.html index 2cf008aa2..f0a660c19 100644 --- a/test/index.html +++ b/test/index.html @@ -503,8 +503,11 @@ {{/action }} diff --git a/test/views/attachment_view_test.js b/test/views/attachment_view_test.js index dad79bafe..68aaf9267 100644 --- a/test/views/attachment_view_test.js +++ b/test/views/attachment_view_test.js @@ -2,15 +2,30 @@ describe('AttachmentView', function() { describe('with arbitrary files', function() { it('should render a file view', function() { - var attachment = { contentType: 'arbitrary/content' }; + var attachment = { + contentType: 'unused', + size: 1232 + }; var view = new Whisper.AttachmentView({model: attachment}).render(); assert.match(view.el.innerHTML, /fileView/); }); it('should display the filename if present', function() { - var attachment = { contentType: 'arbitrary/content', fileName: 'foo.txt' }; + var attachment = { + fileName: 'foo.txt', + contentType: 'unused', + size: 1232, + }; var view = new Whisper.AttachmentView({model: attachment}).render(); assert.match(view.el.innerHTML, /foo.txt/); }); + it('should render a file size', function() { + var attachment = { + size: 1232, + contentType: 'unused' + }; + var view = new Whisper.AttachmentView({model: attachment}).render(); + assert.match(view.el.innerHTML, /1.2 KB/); + }); }); it('should render an image for images', function() { var now = new Date().getTime();