diff --git a/tests/specs/options.js b/tests/specs/options.js index c35fd1b..52504df 100644 --- a/tests/specs/options.js +++ b/tests/specs/options.js @@ -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) + + }) + }) }); diff --git a/tests/specs/static-methods.js b/tests/specs/static-methods.js index e71c689..4765351 100644 --- a/tests/specs/static-methods.js +++ b/tests/specs/static-methods.js @@ -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 () {