@@ -2,7 +2,7 @@ import { fakeAsync, TestBed, tick, flush, waitForAsync } from '@angular/core/tes
2
2
import { By } from '@angular/platform-browser' ;
3
3
import { NoopAnimationsModule } from '@angular/platform-browser/animations' ;
4
4
import { 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' ;
6
6
import { UIInteractions } from '../../test-utils/ui-interactions.spec' ;
7
7
import { configureTestSuite } from '../../test-utils/configure-suite' ;
8
8
import { HorizontalAlignment , VerticalAlignment , AutoPositionStrategy } from '../../services/public_api' ;
@@ -21,7 +21,8 @@ describe('IgxTooltip', () => {
21
21
TestBed . configureTestingModule ( {
22
22
declarations : [
23
23
IgxTooltipSingleTargetComponent ,
24
- IgxTooltipMultipleTargetsComponent
24
+ IgxTooltipMultipleTargetsComponent ,
25
+ IgxTooltipPlainStringComponent
25
26
] ,
26
27
imports : [ NoopAnimationsModule , IgxTooltipModule ]
27
28
} ) . compileComponents ( ) ;
@@ -79,6 +80,14 @@ describe('IgxTooltip', () => {
79
80
verifyTooltipVisibility ( tooltipNativeElement , tooltipTarget , false ) ;
80
81
} ) ) ;
81
82
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
+
82
91
it ( 'verify tooltip default position' , fakeAsync ( ( ) => {
83
92
hoverElement ( button ) ;
84
93
flush ( ) ;
@@ -260,6 +269,33 @@ describe('IgxTooltip', () => {
260
269
verifyTooltipVisibility ( tooltipNativeElement , tooltipTarget , false ) ;
261
270
} ) ) ;
262
271
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
+
263
299
describe ( 'Tooltip events' , ( ) => {
264
300
// configureTestSuite();
265
301
it ( 'should emit the proper events when hovering/unhovering target' , fakeAsync ( ( ) => {
0 commit comments