File tree Expand file tree Collapse file tree 3 files changed +15
-0
lines changed Expand file tree Collapse file tree 3 files changed +15
-0
lines changed Original file line number Diff line number Diff line change 1
1
import { ViewContainerRef } from '@angular/core' ;
2
+ import { LayoutDirection } from '../core' ;
2
3
3
4
/** Valid ARIA roles for a dialog element. */
4
5
export type DialogRole = 'dialog' | 'alertdialog' ;
@@ -48,5 +49,8 @@ export class MdDialogConfig {
48
49
/** Data being injected into the child component. */
49
50
data ?: any = null ;
50
51
52
+ /** Layout direction for the dialog's content. */
53
+ direction ?: LayoutDirection = 'ltr' ;
54
+
51
55
// TODO(jelbourn): add configuration for lifecycle hooks, ARIA labelling.
52
56
}
Original file line number Diff line number Diff line change @@ -312,6 +312,16 @@ describe('MdDialog', () => {
312
312
expect ( overlayPane . style . width ) . toBe ( '200px' ) ;
313
313
} ) ;
314
314
315
+ it ( 'should allow setting the layout direction' , ( ) => {
316
+ let dialogRef = dialog . open ( PizzaMsg , { direction : 'rtl' } ) ;
317
+
318
+ viewContainerFixture . detectChanges ( ) ;
319
+
320
+ let overlayPane = overlayContainerElement . querySelector ( '.cdk-overlay-pane' ) ;
321
+
322
+ expect ( overlayPane . getAttribute ( 'dir' ) ) . toBe ( 'rtl' ) ;
323
+ } ) ;
324
+
315
325
it ( 'should close all of the dialogs' , async ( ( ) => {
316
326
dialog . open ( PizzaMsg ) ;
317
327
dialog . open ( PizzaMsg ) ;
Original file line number Diff line number Diff line change @@ -122,6 +122,7 @@ export class MdDialog {
122
122
private _getOverlayState ( dialogConfig : MdDialogConfig ) : OverlayState {
123
123
let overlayState = new OverlayState ( ) ;
124
124
overlayState . hasBackdrop = dialogConfig . hasBackdrop ;
125
+ overlayState . direction = dialogConfig . direction ;
125
126
overlayState . scrollStrategy = new BlockScrollStrategy ( this . _viewportRuler ) ;
126
127
if ( dialogConfig . backdropClass ) {
127
128
overlayState . backdropClass = dialogConfig . backdropClass ;
You can’t perform that action at this time.
0 commit comments