diff options
author | Vincent Petry <pvince81@owncloud.com> | 2015-08-24 17:16:20 +0200 |
---|---|---|
committer | Vincent Petry <pvince81@owncloud.com> | 2015-08-24 17:16:20 +0200 |
commit | 37939fb0e83b09208c1462ddc80d07fb3e622b36 (patch) | |
tree | 93be8b2be193a6926df775a978ab1c01329085e6 /apps/files/tests | |
parent | a67a2272e77485391695af84644e7a9074e50af8 (diff) | |
download | nextcloud-server-37939fb0e83b09208c1462ddc80d07fb3e622b36.tar.gz nextcloud-server-37939fb0e83b09208c1462ddc80d07fb3e622b36.zip |
Parse mtime from the data attributes
Diffstat (limited to 'apps/files/tests')
-rw-r--r-- | apps/files/tests/js/filelistSpec.js | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/apps/files/tests/js/filelistSpec.js b/apps/files/tests/js/filelistSpec.js index 7ed60084fa9..a6d72a88efd 100644 --- a/apps/files/tests/js/filelistSpec.js +++ b/apps/files/tests/js/filelistSpec.js @@ -98,6 +98,7 @@ describe('OCA.Files.FileList tests', function() { type: 'file', name: 'One.txt', mimetype: 'text/plain', + mtime: 123456789, size: 12, etag: 'abc', permissions: OC.PERMISSION_ALL @@ -106,6 +107,7 @@ describe('OCA.Files.FileList tests', function() { type: 'file', name: 'Two.jpg', mimetype: 'image/jpeg', + mtime: 234567890, size: 12049, etag: 'def', permissions: OC.PERMISSION_ALL @@ -114,6 +116,7 @@ describe('OCA.Files.FileList tests', function() { type: 'file', name: 'Three.pdf', mimetype: 'application/pdf', + mtime: 234560000, size: 58009, etag: '123', permissions: OC.PERMISSION_ALL @@ -122,6 +125,7 @@ describe('OCA.Files.FileList tests', function() { type: 'dir', name: 'somedir', mimetype: 'httpd/unix-directory', + mtime: 134560000, size: 250, etag: '456', permissions: OC.PERMISSION_ALL @@ -1722,6 +1726,7 @@ describe('OCA.Files.FileList tests', function() { id: 1, name: 'One.txt', mimetype: 'text/plain', + mtime: 123456789, type: 'file', size: 12, etag: 'abc', @@ -1732,6 +1737,7 @@ describe('OCA.Files.FileList tests', function() { type: 'file', name: 'Three.pdf', mimetype: 'application/pdf', + mtime: 234560000, size: 58009, etag: '123', permissions: OC.PERMISSION_ALL @@ -1741,6 +1747,7 @@ describe('OCA.Files.FileList tests', function() { type: 'dir', name: 'somedir', mimetype: 'httpd/unix-directory', + mtime: 134560000, size: 250, etag: '456', permissions: OC.PERMISSION_ALL @@ -1754,6 +1761,7 @@ describe('OCA.Files.FileList tests', function() { id: 1, name: 'One.txt', mimetype: 'text/plain', + mtime: 123456789, type: 'file', size: 12, etag: 'abc', @@ -1764,6 +1772,7 @@ describe('OCA.Files.FileList tests', function() { type: 'dir', name: 'somedir', mimetype: 'httpd/unix-directory', + mtime: 134560000, size: 250, etag: '456', permissions: OC.PERMISSION_ALL @@ -2330,4 +2339,24 @@ describe('OCA.Files.FileList tests', function() { }); }); }); + describe('elementToFile', function() { + var $tr; + + beforeEach(function() { + fileList.setFiles(testFiles); + $tr = fileList.findFileEl('One.txt'); + }); + + it('converts data attributes to file info structure', function() { + var fileInfo = fileList.elementToFile($tr); + expect(fileInfo.id).toEqual(1); + expect(fileInfo.name).toEqual('One.txt'); + expect(fileInfo.mtime).toEqual(123456789); + expect(fileInfo.etag).toEqual('abc'); + expect(fileInfo.permissions).toEqual(OC.PERMISSION_ALL); + expect(fileInfo.size).toEqual(12); + expect(fileInfo.mimetype).toEqual('text/plain'); + expect(fileInfo.type).toEqual('file'); + }); + }); }); |