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' ;
@@ -51,5 +52,8 @@ export class MdDialogConfig {
51
52
/** Data being injected into the child component. */
52
53
data ?: any = null ;
53
54
55
+ /** Layout direction for the dialog's content. */
56
+ direction ?: LayoutDirection = 'ltr' ;
57
+
54
58
// TODO(jelbourn): add configuration for lifecycle hooks, ARIA labelling.
55
59
}
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 @@ -127,6 +127,7 @@ export class MdDialog {
127
127
overlayState . panelClass = dialogConfig . panelClass ;
128
128
overlayState . hasBackdrop = dialogConfig . hasBackdrop ;
129
129
overlayState . scrollStrategy = this . _overlay . scrollStrategies . block ( ) ;
130
+ overlayState . direction = dialogConfig . direction ;
130
131
if ( dialogConfig . backdropClass ) {
131
132
overlayState . backdropClass = dialogConfig . backdropClass ;
132
133
}
You can’t perform that action at this time.
0 commit comments