mirror of
https://github.com/frappe/air-datepicker.git
synced 2026-01-14 11:01:22 +08:00
begin test timepicker
This commit is contained in:
parent
2d0dbf0b3b
commit
8c4b94547a
@ -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)
|
||||
|
||||
})
|
||||
})
|
||||
});
|
||||
|
||||
@ -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 () {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user