@@ -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 , IgxTooltipWithCloseButtonComponent } from '../../test-utils/tooltip-components.spec' ;
5+ import { IgxTooltipSingleTargetComponent , IgxTooltipMultipleTargetsComponent , IgxTooltipPlainStringComponent , IgxTooltipWithToggleActionComponent , 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' ;
@@ -30,7 +30,8 @@ describe('IgxTooltip', () => {
3030 IgxTooltipMultipleTargetsComponent ,
3131 IgxTooltipPlainStringComponent ,
3232 IgxTooltipWithToggleActionComponent ,
33- IgxTooltipWithCloseButtonComponent
33+ IgxTooltipWithCloseButtonComponent ,
34+ IgxTooltipWithNestedContentComponent
3435 ]
3536 } ) . compileComponents ( ) ;
3637 UIInteractions . clearOverlay ( ) ;
@@ -546,6 +547,36 @@ describe('IgxTooltip', () => {
546547
547548 verifyTooltipVisibility ( tooltipNativeElement , tooltipTarget , false ) ;
548549 } ) ) ;
550+
551+ it ( 'Should respect default max-width constraint for plain string tooltip' , fakeAsync ( ( ) => {
552+ hoverElement ( button ) ;
553+ flush ( ) ;
554+
555+ verifyTooltipVisibility ( tooltipNativeElement , tooltipTarget , true ) ;
556+
557+ const maxWidth = getComputedStyle ( tooltipNativeElement ) . maxWidth ;
558+ expect ( maxWidth ) . toBe ( '200px' ) ;
559+ } ) ) ;
560+ } ) ;
561+
562+ describe ( 'Custom content tooltip' , ( ) => {
563+ beforeEach ( waitForAsync ( ( ) => {
564+ fix = TestBed . createComponent ( IgxTooltipWithNestedContentComponent ) ;
565+ fix . detectChanges ( ) ;
566+ button = fix . debugElement . query ( By . directive ( IgxTooltipTargetDirective ) ) ;
567+ tooltipTarget = fix . componentInstance . tooltipTarget ;
568+ tooltipNativeElement = fix . debugElement . query ( By . directive ( IgxTooltipDirective ) ) . nativeElement ;
569+ } ) ) ;
570+
571+ it ( 'Should not have max-width constraint for custom content tooltip' , fakeAsync ( ( ) => {
572+ hoverElement ( button ) ;
573+ flush ( ) ;
574+
575+ verifyTooltipVisibility ( tooltipNativeElement , tooltipTarget , true ) ;
576+
577+ const maxWidth = getComputedStyle ( tooltipNativeElement ) . maxWidth ;
578+ expect ( maxWidth ) . toBe ( 'none' ) ;
579+ } ) ) ;
549580 } ) ;
550581
551582 describe ( 'Multiple targets with single tooltip' , ( ) => {
0 commit comments