tests for _parseTime with hex and empty strings
This commit is contained in:
parent
ebfbb97e66
commit
5a0d410488
|
@ -827,6 +827,10 @@ OC.Share={
|
||||||
*/
|
*/
|
||||||
_parseTime: function(time) {
|
_parseTime: function(time) {
|
||||||
if (_.isString(time)) {
|
if (_.isString(time)) {
|
||||||
|
// skip empty strings and hex values
|
||||||
|
if (time === '' || (time.length > 1 && time[0] === '0' && time[1] === 'x')) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
time = parseInt(time, 10);
|
time = parseInt(time, 10);
|
||||||
if(isNaN(time)) {
|
if(isNaN(time)) {
|
||||||
time = null;
|
time = null;
|
||||||
|
|
|
@ -1324,6 +1324,8 @@ describe('OC.Share tests', function() {
|
||||||
[ 123456 , 123456],
|
[ 123456 , 123456],
|
||||||
['0123456', 123456],
|
['0123456', 123456],
|
||||||
['abcdefg', null],
|
['abcdefg', null],
|
||||||
|
['0x12345', null],
|
||||||
|
[ '', null],
|
||||||
], function(value) {
|
], function(value) {
|
||||||
expect(OC.Share._parseTime(value[0])).toEqual(value[1]);
|
expect(OC.Share._parseTime(value[0])).toEqual(value[1]);
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue