Skip to content
This repository has been archived by the owner on May 29, 2019. It is now read-only.

Fixed #3143: fixed functionality of 'show-weeks' attribute on datepicker popup #3149

Closed
wants to merge 7 commits into from
5 changes: 5 additions & 0 deletions src/datepicker/datepicker.js
Original file line number Diff line number Diff line change
Expand Up @@ -529,6 +529,11 @@ function ($compile, $parse, $document, $position, dateFilter, dateParser, datepi
if (attrs.dateDisabled) {
datepickerEl.attr('date-disabled', 'dateDisabled({ date: date, mode: mode })');
}

if (attrs.showWeeks) {
datepickerEl.attr('show-weeks', attrs.showWeeks);
}

if (attrs.customClass){
datepickerEl.attr('custom-class', 'customClass({ date: date, mode: mode })');
}
Expand Down
24 changes: 24 additions & 0 deletions src/datepicker/test/datepicker.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -1640,6 +1640,30 @@ describe('datepicker directive', function () {
assignElements(wrapElement);
expect(dropdownEl.find('li').length).toBe(1);
});

it('should hide weeks column on popup', function() {
var wrapElement = $compile('<div><input ng-model="date" datepicker-popup show-weeks="false"><div>')($rootScope);
$rootScope.$digest();
assignElements(wrapElement);

expect(getLabelsRow().find('th').eq(0)).toBeHidden();
var tr = element.find('tbody').find('tr');
for (var i = 0; i < 5; i++) {
expect(tr.eq(i).find('td').eq(0)).toBeHidden();
}
});

it('should show weeks column on popup', function() {
var wrapElement = $compile('<div><input ng-model="date" datepicker-popup show-weeks="true"><div>')($rootScope);
$rootScope.$digest();
assignElements(wrapElement);

expect(getLabelsRow().find('th').eq(0)).not.toBeHidden();
var tr = element.find('tbody').find('tr');
for (var i = 0; i < 5; i++) {
expect(tr.eq(i).find('td').eq(0)).not.toBeHidden();
}
});
});

describe('`ng-change`', function() {
Expand Down