-
Notifications
You must be signed in to change notification settings - Fork 6.8k
feat(datepicker): add ng-content to datepicker header #13236
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(datepicker): add ng-content to datepicker header #13236
Conversation
- add ng-content to datepicker header to simplify customization of this component - fix tests using calendarHeaderComponent property to correctly reference the custom component - add test to prove that custom component was rendered Closes angular#13212
<mat-calendar-header #header> | ||
<button mat-button type="button" class="mat-calendar-today-button" | ||
(click)="todayClicked()" [attr.aria-label]="todayButtonLabel" | ||
cdkAriaLive="polite"> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The button shouldn't have cdkAriaLive
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should I remove attr.aria-label
as well? To be honest I was just following suit based on the buttons in mat-calendar-header
(https://github.com/angular/material2/blob/master/src/lib/datepicker/calendar-header.html#L4-L5)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've gone ahead and removed it for brevity
})); | ||
}); | ||
|
||
describe('datepicker with custom header using ng-content', () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure whether we need a test for this. It's basically testing if ng-content
works which isn't something Material is responsible for.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree with this comment for the datepicker with custom header using ng-content
suite I added and will remove.
However I think the additional test that checks that the custom element is added is useful for the datepicker with custom header
suite. Prior to my change to DatepickerWithCustomHeader a custom header component was not in fact being used by that test suite.
- remove unnecessary tests - simplify demo code
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
I'd like @mmalerba to weigh in on this I'm a little iffy about projecting all of the content. |
I think this should be fine, we won't project anything in the default case, but if people are using the |
* feat(datepicker): add ng-content to datepicker header - add ng-content to datepicker header to simplify customization of this component - fix tests using calendarHeaderComponent property to correctly reference the custom component - add test to prove that custom component was rendered Closes angular#13212 * test(datepicker): code review fixes - remove unnecessary tests - simplify demo code
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
customization of this component
to correctly reference the custom component
rendered
Closes #13212