From 06750cc91348754bcde96919c3219c021326d2dc Mon Sep 17 00:00:00 2001 From: t1m0n Date: Wed, 6 Jan 2016 11:26:37 +0300 Subject: [PATCH] fix .getParsedDates test, add multipleDates test --- tests/specs/options.js | 29 ++++++++++++++++++++++++++++- tests/specs/static-methods.js | 2 +- 2 files changed, 29 insertions(+), 2 deletions(-) diff --git a/tests/specs/options.js b/tests/specs/options.js index c187190..4868b2f 100644 --- a/tests/specs/options.js +++ b/tests/specs/options.js @@ -609,7 +609,6 @@ describe('Options', function () { it('if `true` then navigation buttons will be disabled if there is no more possible dates to select to in next or prev month', function () { var date = new Date(2015, 11, 30); - destroy = false; dp = $input.datepicker({ minDate: date, inline: true @@ -621,5 +620,33 @@ describe('Options', function () { expect($prev.attr('class')).to.have.string('-disabled-') }) + }); + + describe('multipleDates', function () { + it('if `true` then one can select multiple dates', function () { + dp = $input.datepicker({ + multipleDates: true + }).data('datepicker'); + + dp.selectDate(new Date(2016, 0, 7)); + dp.selectDate(new Date(2016, 0, 8)); + dp.selectDate(new Date(2016, 0, 9)); + + expect(dp.selectedDates).to.have.length(3) + }); + + it('if `number` should limit length of selected dates by its value', function () { + dp = $input.datepicker({ + multipleDates: 3 + }).data('datepicker'); + + dp.selectDate(new Date(2016, 0, 7)); + dp.selectDate(new Date(2016, 0, 8)); + dp.selectDate(new Date(2016, 0, 9)); + dp.selectDate(new Date(2016, 0, 10)); + dp.selectDate(new Date(2016, 0, 11)); + + expect(dp.selectedDates).to.have.length(3) + }) }) }); diff --git a/tests/specs/static-methods.js b/tests/specs/static-methods.js index 606228f..e71c689 100644 --- a/tests/specs/static-methods.js +++ b/tests/specs/static-methods.js @@ -34,7 +34,7 @@ describe('Datepicker', function () { }); describe('.fullMonth', function () { it('`fullMonth` must be equal to current month + 1 with leading zero', function () { - assert.equal(currentDate.getMonth() < 10 ? '0' + (currentDate.getMonth()) + 1 : currentDate.getMonth() + 1 , date.fullMonth); + assert.equal(currentDate.getMonth() < 10 ? '0' + (currentDate.getMonth() + 1) : currentDate.getMonth() + 1 , date.fullMonth); }) }); describe('.date', function () {