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

Commit

Permalink
fix(datepicker): make 'show-weeks' work on datepickerPopup
Browse files Browse the repository at this point in the history
Fixes #3143
Closes #3149
  • Loading branch information
ankit5990 authored and chrisirhc committed Apr 6, 2015
1 parent d024dd7 commit d0cc728
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/datepicker/datepicker.js
Original file line number Diff line number Diff line change
Expand Up @@ -535,6 +535,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 @@ -1704,6 +1704,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

0 comments on commit d0cc728

Please sign in to comment.