diff options
author | Arthur Schiwon <blizzz@owncloud.com> | 2015-07-22 20:15:12 +0200 |
---|---|---|
committer | Arthur Schiwon <blizzz@owncloud.com> | 2015-08-07 01:22:43 +0200 |
commit | 734c6b0b6f10cb8cb39773e1c93088c24c9f50af (patch) | |
tree | ccf7d6f3adac494834afe3706b378ab1a6255938 | |
parent | 7a982872e7310ffff979a2842ada88db1f832680 (diff) | |
download | nextcloud-server-734c6b0b6f10cb8cb39773e1c93088c24c9f50af.tar.gz nextcloud-server-734c6b0b6f10cb8cb39773e1c93088c24c9f50af.zip |
extend MainFileInfoDetailView JS tests
-rw-r--r-- | apps/files/tests/js/mainfileinfodetailviewSpec.js | 32 |
1 files 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(); }); }); }); |