fix .getParsedDates test, add multipleDates test

This commit is contained in:
t1m0n 2016-01-06 11:26:37 +03:00
parent 968c0ec01c
commit 06750cc913
2 changed files with 29 additions and 2 deletions

View File

@ -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)
})
})
});

View File

@ -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 () {