Skip to content

Commit 0ff8d5d

Browse files
mmalerbakara
authored andcommitted
feat(dialog): add datepicker dialog and popup classes for easy styling (#7013)
1 parent c6824d5 commit 0ff8d5d

File tree

2 files changed

+8
-5
lines changed

2 files changed

+8
-5
lines changed

src/lib/datepicker/datepicker.spec.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -82,24 +82,25 @@ describe('MatDatepicker', () => {
8282
}));
8383

8484
it('open non-touch should open popup', () => {
85-
expect(document.querySelector('.cdk-overlay-pane')).toBeNull();
85+
expect(document.querySelector('.cdk-overlay-pane.mat-datepicker-popup')).toBeNull();
8686

8787
testComponent.datepicker.open();
8888
fixture.detectChanges();
8989

90-
expect(document.querySelector('.cdk-overlay-pane')).not.toBeNull();
90+
expect(document.querySelector('.cdk-overlay-pane.mat-datepicker-popup')).not.toBeNull();
9191
});
9292

9393
it('open touch should open dialog', () => {
9494
testComponent.touch = true;
9595
fixture.detectChanges();
9696

97-
expect(document.querySelector('mat-dialog-container')).toBeNull();
97+
expect(document.querySelector('.mat-datepicker-dialog mat-dialog-container')).toBeNull();
9898

9999
testComponent.datepicker.open();
100100
fixture.detectChanges();
101101

102-
expect(document.querySelector('mat-dialog-container')).not.toBeNull();
102+
expect(document.querySelector('.mat-datepicker-dialog mat-dialog-container'))
103+
.not.toBeNull();
103104
});
104105

105106
it('open in disabled mode should not open the calendar', () => {

src/lib/datepicker/datepicker.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -302,6 +302,7 @@ export class MatDatepicker<D> implements OnDestroy {
302302
this._dialogRef = this._dialog.open(MatDatepickerContent, {
303303
direction: this._dir ? this._dir.value : 'ltr',
304304
viewContainerRef: this._viewContainerRef,
305+
panelClass: 'mat-datepicker-dialog',
305306
});
306307
this._dialogRef.afterClosed().subscribe(() => this.close());
307308
this._dialogRef.componentInstance.datepicker = this;
@@ -338,7 +339,8 @@ export class MatDatepicker<D> implements OnDestroy {
338339
hasBackdrop: true,
339340
backdropClass: 'mat-overlay-transparent-backdrop',
340341
direction: this._dir ? this._dir.value : 'ltr',
341-
scrollStrategy: this._scrollStrategy()
342+
scrollStrategy: this._scrollStrategy(),
343+
panelClass: 'mat-datepicker-popup',
342344
});
343345

344346
this._popupRef = this._overlay.create(overlayConfig);

0 commit comments

Comments
 (0)