Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions src/cdk/overlay/position/global-position-strategy.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -289,6 +289,16 @@ describe('GlobalPositonStrategy', () => {
const parentStyle = (overlayRef.overlayElement.parentNode as HTMLElement).style;
expect(parentStyle.justifyContent).toBe('flex-start');
});

it('should use `justify-content` to center when using center horizontally in RTL', () => {
attachOverlay({
positionStrategy: overlay.position().global().centerHorizontally(),
direction: 'rtl'
});

const parentStyle = (overlayRef.overlayElement.parentNode as HTMLElement).style;
expect(parentStyle.justifyContent).toBe('center');
});
});


Expand Down
2 changes: 2 additions & 0 deletions src/cdk/overlay/position/global-position-strategy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,8 @@ export class GlobalPositionStrategy implements PositionStrategy {
parentStyles.justifyContent = 'flex-end';
} else if (this._justifyContent === 'flex-end') {
parentStyles.justifyContent = 'flex-start';
} else {
parentStyles.justifyContent = this._justifyContent;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like this needs a unit test

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

}
} else {
parentStyles.justifyContent = this._justifyContent;
Expand Down