From 734c6b0b6f10cb8cb39773e1c93088c24c9f50af Mon Sep 17 00:00:00 2001 From: Arthur Schiwon Date: Wed, 22 Jul 2015 20:15:12 +0200 Subject: extend MainFileInfoDetailView JS tests --- apps/files/tests/js/mainfileinfodetailviewSpec.js | 32 ++++++++++++++++++++--- 1 file changed, 29 insertions(+), 3 deletions(-) diff --git a/apps/files/tests/js/mainfileinfodetailviewSpec.js b/apps/files/tests/js/mainfileinfodetailviewSpec.js index ed7c6401a77..2dec4ea8a1a 100644 --- a/apps/files/tests/js/mainfileinfodetailviewSpec.js +++ b/apps/files/tests/js/mainfileinfodetailviewSpec.js @@ -20,16 +20,19 @@ */ describe('OCA.Files.MainFileInfoDetailView tests', function() { - var view, tipsyStub; + var view, tipsyStub, previewStub, fncLazyLoadPreview, fileListMock; beforeEach(function() { tipsyStub = sinon.stub($.fn, 'tipsy'); + fileListMock = sinon.mock(OCA.Files.FileList.prototype); view = new OCA.Files.MainFileInfoDetailView(); }); afterEach(function() { view.destroy(); view = undefined; tipsyStub.restore(); + fileListMock.restore(); + }); describe('rendering', function() { var testFileInfo; @@ -68,10 +71,33 @@ describe('OCA.Files.MainFileInfoDetailView tests', function() { .toEqual(OC.imagePath('core', 'actions/star')); }); it('displays mime icon', function() { - // TODO + // File + view.setFileInfo(_.extend(testFileInfo, { + mimetype: 'text/calendar' + })); + + expect(view.$el.find('.thumbnail').css('background-image')) + .toContain('filetypes/text-calendar.svg'); + + // Folder + view.setFileInfo(_.extend(testFileInfo, { + mimetype: 'httpd/unix-directory' + })); + + expect(view.$el.find('.thumbnail').css('background-image')) + .toContain('filetypes/folder.svg'); }); it('displays thumbnail', function() { - // TODO + view.setFileInfo(_.extend(testFileInfo, { + mimetype: 'text/plain' + })); + + var expectation = fileListMock.expects('lazyLoadPreview'); + expectation.once(); + + view.setFileInfo(testFileInfo); + + fileListMock.verify(); }); }); }); -- cgit v1.2.3