From eb7a796ad98ec833e49c2544f03da52d11c302b1 Mon Sep 17 00:00:00 2001 From: Roeland Jago Douma <roeland@famdouma.nl> Date: Thu, 9 Jul 2015 18:42:46 +0200 Subject: [PATCH] Fix unit tests --- apps/files/js/filelist.js | 8 ++++++++ apps/files/tests/js/filelistSpec.js | 7 ++++--- apps/files_sharing/tests/js/shareSpec.js | 2 +- 3 files changed, 13 insertions(+), 4 deletions(-) diff --git a/apps/files/js/filelist.js b/apps/files/js/filelist.js index 79ee355125..a3fd605ff7 100644 --- a/apps/files/js/filelist.js +++ b/apps/files/js/filelist.js @@ -710,6 +710,14 @@ path = this.getCurrentDirectory(); } + if (type === 'dir') { + // use default folder icon + icon = icon || OC.imagePath('core', 'filetypes/folder'); + } + else { + icon = icon || OC.imagePath('core', 'filetypes/file'); + } + // filename td td = $('<td class="filename"></td>'); diff --git a/apps/files/tests/js/filelistSpec.js b/apps/files/tests/js/filelistSpec.js index b12ac2f251..316df0281e 100644 --- a/apps/files/tests/js/filelistSpec.js +++ b/apps/files/tests/js/filelistSpec.js @@ -697,7 +697,7 @@ describe('OCA.Files.FileList tests', function() { expect(fileList.findFileEl('One.txt').length).toEqual(1); expect(OC.TestUtil.getImageUrl(fileList.findFileEl('One.txt').find('.thumbnail'))) - .toEqual(OC.imagePath('core', 'filetypes/file.svg')); + .toEqual(OC.imagePath('core', 'filetypes/text.svg')); }); }); describe('Moving files', function() { @@ -816,7 +816,7 @@ describe('OCA.Files.FileList tests', function() { expect(notificationStub.getCall(0).args[0]).toEqual('Error while moving file'); expect(OC.TestUtil.getImageUrl(fileList.findFileEl('One.txt').find('.thumbnail'))) - .toEqual(OC.imagePath('core', 'filetypes/file.svg')); + .toEqual(OC.imagePath('core', 'filetypes/text.svg')); }); }); describe('List rendering', function() { @@ -1161,7 +1161,8 @@ describe('OCA.Files.FileList tests', function() { var fileData = { type: 'file', name: 'test dir', - icon: OC.webroot + '/core/img/filetypes/application-pdf.svg' + icon: OC.webroot + '/core/img/filetypes/application-pdf.svg', + mimetype: 'application/pdf' }; var $tr = fileList.add(fileData); var $imgDiv = $tr.find('td.filename .thumbnail'); diff --git a/apps/files_sharing/tests/js/shareSpec.js b/apps/files_sharing/tests/js/shareSpec.js index 1bbf4ffca0..aa409285ca 100644 --- a/apps/files_sharing/tests/js/shareSpec.js +++ b/apps/files_sharing/tests/js/shareSpec.js @@ -90,7 +90,7 @@ describe('OCA.Sharing.Util tests', function() { type: 'dir', name: 'One', path: '/subdir', - mimetype: 'text/plain', + mimetype: 'httpd/unix-directory', size: 12, permissions: OC.PERMISSION_ALL, etag: 'abc' -- GitLab