@@ -2,7 +2,7 @@ import { fakeAsync, TestBed, tick, flush, waitForAsync } from '@angular/core/tes
22import { By } from '@angular/platform-browser' ;
33import { NoopAnimationsModule } from '@angular/platform-browser/animations' ;
44import { IgxTooltipModule , IgxTooltipTargetDirective , IgxTooltipDirective } from './' ;
5- import { IgxTooltipSingleTargetComponent , IgxTooltipMultipleTargetsComponent } from '../../test-utils/tooltip-components.spec' ;
5+ import { IgxTooltipSingleTargetComponent , IgxTooltipMultipleTargetsComponent , IgxTooltipPlainStringComponent } from '../../test-utils/tooltip-components.spec' ;
66import { UIInteractions } from '../../test-utils/ui-interactions.spec' ;
77import { configureTestSuite } from '../../test-utils/configure-suite' ;
88import { HorizontalAlignment , VerticalAlignment , AutoPositionStrategy } from '../../services/public_api' ;
@@ -21,7 +21,8 @@ describe('IgxTooltip', () => {
2121 TestBed . configureTestingModule ( {
2222 declarations : [
2323 IgxTooltipSingleTargetComponent ,
24- IgxTooltipMultipleTargetsComponent
24+ IgxTooltipMultipleTargetsComponent ,
25+ IgxTooltipPlainStringComponent
2526 ] ,
2627 imports : [ NoopAnimationsModule , IgxTooltipModule ]
2728 } ) . compileComponents ( ) ;
@@ -79,6 +80,14 @@ describe('IgxTooltip', () => {
7980 verifyTooltipVisibility ( tooltipNativeElement , tooltipTarget , false ) ;
8081 } ) ) ;
8182
83+ it ( 'show target tooltip when hovering its target and ignore [tooltip] input' , fakeAsync ( ( ) => {
84+ hoverElement ( button ) ;
85+ flush ( ) ;
86+
87+ verifyTooltipVisibility ( tooltipNativeElement , tooltipTarget , true ) ;
88+ expect ( tooltipNativeElement . textContent . trim ( ) ) . toEqual ( 'Hello, I am a tooltip!' ) ;
89+ } ) ) ;
90+
8291 it ( 'verify tooltip default position' , fakeAsync ( ( ) => {
8392 hoverElement ( button ) ;
8493 flush ( ) ;
@@ -260,6 +269,33 @@ describe('IgxTooltip', () => {
260269 verifyTooltipVisibility ( tooltipNativeElement , tooltipTarget , false ) ;
261270 } ) ) ;
262271
272+ describe ( 'Plain string toopltip input' , ( ) => {
273+ // configureTestSuite();
274+ beforeEach ( waitForAsync ( ( ) => {
275+ fix = TestBed . createComponent ( IgxTooltipPlainStringComponent ) ;
276+ fix . detectChanges ( ) ;
277+ button = fix . debugElement . query ( By . directive ( IgxTooltipTargetDirective ) ) ;
278+ tooltipTarget = fix . componentInstance . tooltipTarget ;
279+ tooltipNativeElement = fix . debugElement . query ( By . directive ( IgxTooltipDirective ) ) . nativeElement ;
280+ } ) ) ;
281+
282+ it ( 'IgxTooltip is initially hidden' , ( ) => {
283+ verifyTooltipVisibility ( tooltipNativeElement , tooltipTarget , false ) ;
284+ } ) ;
285+
286+ it ( 'IgxTooltip is shown/hidden when hovering/unhovering its target' , fakeAsync ( ( ) => {
287+ hoverElement ( button ) ;
288+ flush ( ) ;
289+
290+ verifyTooltipVisibility ( tooltipNativeElement , tooltipTarget , true ) ;
291+
292+ unhoverElement ( button ) ;
293+ flush ( ) ;
294+
295+ verifyTooltipVisibility ( tooltipNativeElement , tooltipTarget , false ) ;
296+ } ) ) ;
297+ } ) ;
298+
263299 describe ( 'Tooltip events' , ( ) => {
264300 // configureTestSuite();
265301 it ( 'should emit the proper events when hovering/unhovering target' , fakeAsync ( ( ) => {
0 commit comments