Skip to content

Commit

Permalink
fix(tooltip): not using trigger's text direction (#4413)
Browse files Browse the repository at this point in the history
Passes the trigger's layout direction along to the tooltip element.

Fixes #4411.
  • Loading branch information
crisbeto authored and jelbourn committed May 17, 2017
1 parent ef6b9aa commit d8aeeaa
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
13 changes: 13 additions & 0 deletions src/lib/tooltip/tooltip.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -353,6 +353,19 @@ describe('MdTooltip', () => {
tooltipDirective.show();
}).toThrowError('Tooltip position "everywhere" is invalid.');
});

it('should pass the layout direction to the tooltip', fakeAsync(() => {
dir.value = 'rtl';

tooltipDirective.show();
tick(0);
fixture.detectChanges();

const tooltipWrapper = overlayContainerElement.querySelector('.cdk-overlay-pane');

expect(tooltipWrapper).toBeTruthy('Expected tooltip to be shown.');
expect(tooltipWrapper.getAttribute('dir')).toBe('rtl', 'Expected tooltip to be in RTL mode.');
}));
});

describe('scrollable usage', () => {
Expand Down
2 changes: 2 additions & 0 deletions src/lib/tooltip/tooltip.ts
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,9 @@ export class MdTooltip implements OnDestroy {
this.hide(0);
}
});

let config = new OverlayState();
config.direction = this._dir ? this._dir.value : 'ltr';
config.positionStrategy = strategy;
config.scrollStrategy =
new RepositionScrollStrategy(this._scrollDispatcher, SCROLL_THROTTLE_MS);
Expand Down

0 comments on commit d8aeeaa

Please sign in to comment.