begin test timepicker

This commit is contained in:
t1m0n 2016-03-02 11:20:53 +03:00
parent 2d0dbf0b3b
commit 8c4b94547a
2 changed files with 41 additions and 3 deletions

View File

@ -121,9 +121,15 @@ describe('Options', function () {
});
describe('dateFormat', function () {
var date = new Date(2015, 6, 4),
var date = new Date(2015, 6, 4, 11, 5),
formats = {
'@': date.getTime(),
'aa': 'am',
'AA': 'AM',
'h': 11,
'hh': 11,
'i': 5,
'ii': '05',
'dd': '04',
'd': 4,
'DD': 'Суббота',
@ -807,4 +813,16 @@ describe('Options', function () {
});
});
describe('timepicker', function () {
it('should add timepicker to calendar', function () {
dp = $input.datepicker({
timepicker: true
}).data('datepicker');
var $time = $('.datepicker--time', dp.$datepicker);
expect($time).to.have.length(1)
})
})
});

View File

@ -19,7 +19,7 @@ describe('Datepicker', function () {
date = Datepicker.getParsedDate(currentDate);
it('should return object with detailed date fields', function () {
expect(date).to.have.all.keys(['year','month','fullMonth','date', 'fullDate', 'day']);
expect(date).to.have.all.keys(['year','month','fullMonth','date', 'fullDate', 'day','hours', 'fullHours', 'minutes', 'fullMinutes']);
});
describe('.year', function () {
@ -51,8 +51,28 @@ describe('Datepicker', function () {
it('`day` must be equal to current day', function () {
assert.equal(currentDate.getDay(), date.day);
})
});
describe('.hours', function () {
it('`hours` must be equal to current hours', function () {
assert.equal(currentDate.getHours(), date.hours);
})
});
describe('.fullHours', function () {
it('`fullHours` must be equal to current hours with leading zero', function () {
assert.equal(currentDate.getHours() < 10 ? '0' + currentDate.getHours() : currentDate.getHours(), date.hours);
})
});
describe('.minutes', function () {
it('`minutes` must be equal to current minutes', function () {
assert.equal(currentDate.getMinutes(), date.minutes);
})
});
describe('.fullMinutes', function () {
it('`fullMinutes` must be equal to current hours with leading zero', function () {
assert.equal(currentDate.getMinutes() < 10 ? '0' + currentDate.getMinutes() : currentDate.getMinutes(), date.fullMinutes);
})
})
})
});
describe('getDecade', function () {
it('should return array with first and last years in decade', function () {