From beae00a5e5457c41994e54c7f0563245d9ccf5ce Mon Sep 17 00:00:00 2001 From: Morris Jobke Date: Thu, 7 Jul 2016 09:54:32 +0200 Subject: [PATCH] Simplify test code and don't show anything if no date is set --- apps/files_sharing/js/sharedfilelist.js | 2 +- apps/files_sharing/tests/js/sharedfilelistSpec.js | 12 +++--------- 2 files changed, 4 insertions(+), 10 deletions(-) diff --git a/apps/files_sharing/js/sharedfilelist.js b/apps/files_sharing/js/sharedfilelist.js index ca87acd6ceb..dccd6027b02 100644 --- a/apps/files_sharing/js/sharedfilelist.js +++ b/apps/files_sharing/js/sharedfilelist.js @@ -101,7 +101,7 @@ text = OC.Util.relativeModifiedDate(expirationTimestamp); } else { formatted = t('files_sharing', 'No expiration date set'); - text = t('files_sharing', 'Never'); + text = ''; modifiedColor = 160; } td = $('').attr({"class": "date"}); diff --git a/apps/files_sharing/tests/js/sharedfilelistSpec.js b/apps/files_sharing/tests/js/sharedfilelistSpec.js index a4448a1c0e2..f177b61c78a 100644 --- a/apps/files_sharing/tests/js/sharedfilelistSpec.js +++ b/apps/files_sharing/tests/js/sharedfilelistSpec.js @@ -515,14 +515,8 @@ describe('OCA.Sharing.FileList tests', function() { fileList.reload(); - var currentdate = new Date(); - var expirationDateInADay = - + currentdate.getFullYear() + "-" - + ((currentdate.getMonth()+1 < 10) ? "0" : "") + (currentdate.getMonth()+1) + "-" - + ((currentdate.getDate()+1 < 10) ? "0" : "") + (currentdate.getDate()+1) + " " - + ((currentdate.getHours()+1 < 10) ? "0" : "") + currentdate.getHours() + ":" - + ((currentdate.getMinutes()+1 < 10) ? "0" : "") + currentdate.getMinutes() + ":" - + ((currentdate.getSeconds()+1 < 10) ? "0" : "") + currentdate.getSeconds(); + var expirationDateInADay = moment() + .add(1, 'days').format('YYYY-MM-DD HH:mm:ss'); /* jshint camelcase: false */ ocsResponse = { @@ -617,7 +611,7 @@ describe('OCA.Sharing.FileList tests', function() { OC.webroot + '/remote.php/webdav/local%20path/local%20name.txt' ); expect($tr.attr('data-expiration')).toEqual('0'); - expect($tr.find('td:last-child span').text()).toEqual('Never'); + expect($tr.find('td:last-child span').text()).toEqual(''); expect($tr.find('.nametext').text().trim()).toEqual('local name.txt');