summaryrefslogtreecommitdiffstats
path: root/apps/files
diff options
context:
space:
mode:
authorMorris Jobke <hey@morrisjobke.de>2015-08-24 19:44:46 +0200
committerMorris Jobke <hey@morrisjobke.de>2015-08-24 19:44:46 +0200
commitb2fcdd65cddf03b2faea25b8bc6f220a7b8bdcbd (patch)
tree83c93dea3d42a45f16510cb2c0e91333c6d6d43c /apps/files
parent1797bb576f79aa6f11addf9f9c253ff25376e23e (diff)
parent37939fb0e83b09208c1462ddc80d07fb3e622b36 (diff)
downloadnextcloud-server-b2fcdd65cddf03b2faea25b8bc6f220a7b8bdcbd.tar.gz
nextcloud-server-b2fcdd65cddf03b2faea25b8bc6f220a7b8bdcbd.zip
Merge pull request #18528 from owncloud/files-sidebar-mtime
Parse mtime from the data attributes
Diffstat (limited to 'apps/files')
-rw-r--r--apps/files/js/filelist.js1
-rw-r--r--apps/files/tests/js/filelistSpec.js29
2 files changed, 30 insertions, 0 deletions
diff --git a/apps/files/js/filelist.js b/apps/files/js/filelist.js
index eb46f155269..e294e2f3c09 100644
--- a/apps/files/js/filelist.js
+++ b/apps/files/js/filelist.js
@@ -673,6 +673,7 @@
id: parseInt($el.attr('data-id'), 10),
name: $el.attr('data-file'),
mimetype: $el.attr('data-mime'),
+ mtime: parseInt($el.attr('data-mtime'), 10),
type: $el.attr('data-type'),
size: parseInt($el.attr('data-size'), 10),
etag: $el.attr('data-etag'),
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');
+ });
+ });
});