Simplify test code and don't show anything if no date is set

This commit is contained in:
Morris Jobke 2016-07-07 09:54:32 +02:00
parent 43b26b9506
commit beae00a5e5
2 changed files with 4 additions and 10 deletions

View file

@ -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 = $('<td></td>').attr({"class": "date"});

View file

@ -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');