@@ -2,7 +2,7 @@ import { DebugElement } from '@angular/core';
22import { fakeAsync , TestBed , tick , flush , waitForAsync , ComponentFixture } from '@angular/core/testing' ;
33import { By } from '@angular/platform-browser' ;
44import { NoopAnimationsModule } from '@angular/platform-browser/animations' ;
5- import { IgxTooltipSingleTargetComponent , IgxTooltipMultipleTargetsComponent , IgxTooltipPlainStringComponent , IgxTooltipWithToggleActionComponent , IgxTooltipMultipleTooltipsComponent , IgxTooltipWithCloseButtonComponent } from '../../test-utils/tooltip-components.spec' ;
5+ import { IgxTooltipSingleTargetComponent , IgxTooltipMultipleTargetsComponent , IgxTooltipPlainStringComponent , IgxTooltipWithToggleActionComponent , IgxTooltipMultipleTooltipsComponent , IgxTooltipWithCloseButtonComponent , IgxTooltipWithNestedContentComponent } from '../../test-utils/tooltip-components.spec' ;
66import { UIInteractions } from '../../test-utils/ui-interactions.spec' ;
77import { HorizontalAlignment , VerticalAlignment , AutoPositionStrategy } from '../../services/public_api' ;
88import { IgxTooltipDirective } from './tooltip.directive' ;
@@ -28,7 +28,8 @@ describe('IgxTooltip', () => {
2828 IgxTooltipMultipleTargetsComponent ,
2929 IgxTooltipPlainStringComponent ,
3030 IgxTooltipWithToggleActionComponent ,
31- IgxTooltipWithCloseButtonComponent
31+ IgxTooltipWithCloseButtonComponent ,
32+ IgxTooltipWithNestedContentComponent
3233 ]
3334 } ) . compileComponents ( ) ;
3435 UIInteractions . clearOverlay ( ) ;
@@ -500,6 +501,36 @@ describe('IgxTooltip', () => {
500501
501502 verifyTooltipVisibility ( tooltipNativeElement , tooltipTarget , false ) ;
502503 } ) ) ;
504+
505+ it ( 'Should respect default max-width constraint for plain string tooltip' , fakeAsync ( ( ) => {
506+ hoverElement ( button ) ;
507+ flush ( ) ;
508+
509+ verifyTooltipVisibility ( tooltipNativeElement , tooltipTarget , true ) ;
510+
511+ const maxWidth = getComputedStyle ( tooltipNativeElement ) . maxWidth ;
512+ expect ( maxWidth ) . toBe ( '200px' ) ;
513+ } ) ) ;
514+ } ) ;
515+
516+ describe ( 'Custom content tooltip' , ( ) => {
517+ beforeEach ( waitForAsync ( ( ) => {
518+ fix = TestBed . createComponent ( IgxTooltipWithNestedContentComponent ) ;
519+ fix . detectChanges ( ) ;
520+ button = fix . debugElement . query ( By . directive ( IgxTooltipTargetDirective ) ) ;
521+ tooltipTarget = fix . componentInstance . tooltipTarget ;
522+ tooltipNativeElement = fix . debugElement . query ( By . directive ( IgxTooltipDirective ) ) . nativeElement ;
523+ } ) ) ;
524+
525+ it ( 'Should not have max-width constraint for custom content tooltip' , fakeAsync ( ( ) => {
526+ hoverElement ( button ) ;
527+ flush ( ) ;
528+
529+ verifyTooltipVisibility ( tooltipNativeElement , tooltipTarget , true ) ;
530+
531+ const maxWidth = getComputedStyle ( tooltipNativeElement ) . maxWidth ;
532+ expect ( maxWidth ) . toBe ( 'none' ) ;
533+ } ) ) ;
503534 } ) ;
504535
505536 describe ( 'Multiple targets with single tooltip' , ( ) => {
0 commit comments