@@ -22,7 +22,12 @@ import {NoopAnimationsModule} from '@angular/platform-browser/animations';
22
22
import { Direction , Directionality } from '@angular/cdk/bidi' ;
23
23
import { OverlayContainer , OverlayModule , CdkScrollable } from '@angular/cdk/overlay' ;
24
24
import { Platform } from '@angular/cdk/platform' ;
25
- import { dispatchFakeEvent , dispatchKeyboardEvent , patchElementFocus } from '@angular/cdk/testing' ;
25
+ import {
26
+ dispatchFakeEvent ,
27
+ dispatchKeyboardEvent ,
28
+ patchElementFocus ,
29
+ dispatchMouseEvent ,
30
+ } from '@angular/cdk/testing' ;
26
31
import { ESCAPE } from '@angular/cdk/keycodes' ;
27
32
import { FocusMonitor } from '@angular/cdk/a11y' ;
28
33
import {
@@ -40,12 +45,12 @@ describe('MatTooltip', () => {
40
45
let overlayContainer : OverlayContainer ;
41
46
let overlayContainerElement : HTMLElement ;
42
47
let dir : { value : Direction } ;
43
- let platform : { IOS : boolean , isBrowser : boolean } ;
48
+ let platform : { IOS : boolean , isBrowser : boolean , ANDROID : boolean } ;
44
49
let focusMonitor : FocusMonitor ;
45
50
46
51
beforeEach ( async ( ( ) => {
47
52
// Set the default Platform override that can be updated before component creation.
48
- platform = { IOS : false , isBrowser : true } ;
53
+ platform = { IOS : false , isBrowser : true , ANDROID : false } ;
49
54
50
55
TestBed . configureTestingModule ( {
51
56
imports : [ MatTooltipModule , OverlayModule , NoopAnimationsModule ] ,
@@ -808,6 +813,30 @@ describe('MatTooltip', () => {
808
813
expect ( fixture . componentInstance . button . nativeElement . style . webkitUserDrag ) . toBeFalsy ( ) ;
809
814
} ) ;
810
815
816
+ it ( 'should not open on `mouseenter` on iOS' , ( ) => {
817
+ platform . IOS = true ;
818
+
819
+ const fixture = TestBed . createComponent ( BasicTooltipDemo ) ;
820
+
821
+ fixture . detectChanges ( ) ;
822
+ dispatchMouseEvent ( fixture . componentInstance . button . nativeElement , 'mouseenter' ) ;
823
+ fixture . detectChanges ( ) ;
824
+
825
+ assertTooltipInstance ( fixture . componentInstance . tooltip , false ) ;
826
+ } ) ;
827
+
828
+ it ( 'should not open on `mouseenter` on Android' , ( ) => {
829
+ platform . ANDROID = true ;
830
+
831
+ const fixture = TestBed . createComponent ( BasicTooltipDemo ) ;
832
+
833
+ fixture . detectChanges ( ) ;
834
+ dispatchMouseEvent ( fixture . componentInstance . button . nativeElement , 'mouseenter' ) ;
835
+ fixture . detectChanges ( ) ;
836
+
837
+ assertTooltipInstance ( fixture . componentInstance . tooltip , false ) ;
838
+ } ) ;
839
+
811
840
} ) ;
812
841
813
842
} ) ;
0 commit comments