@@ -22,7 +22,12 @@ import {NoopAnimationsModule} from '@angular/platform-browser/animations';
2222import { Direction , Directionality } from '@angular/cdk/bidi' ;
2323import { OverlayContainer , OverlayModule , CdkScrollable } from '@angular/cdk/overlay' ;
2424import { 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' ;
2631import { ESCAPE } from '@angular/cdk/keycodes' ;
2732import { FocusMonitor } from '@angular/cdk/a11y' ;
2833import {
@@ -40,12 +45,12 @@ describe('MatTooltip', () => {
4045 let overlayContainer : OverlayContainer ;
4146 let overlayContainerElement : HTMLElement ;
4247 let dir : { value : Direction } ;
43- let platform : { IOS : boolean , isBrowser : boolean } ;
48+ let platform : { IOS : boolean , isBrowser : boolean , ANDROID : boolean } ;
4449 let focusMonitor : FocusMonitor ;
4550
4651 beforeEach ( async ( ( ) => {
4752 // 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 } ;
4954
5055 TestBed . configureTestingModule ( {
5156 imports : [ MatTooltipModule , OverlayModule , NoopAnimationsModule ] ,
@@ -808,6 +813,30 @@ describe('MatTooltip', () => {
808813 expect ( fixture . componentInstance . button . nativeElement . style . webkitUserDrag ) . toBeFalsy ( ) ;
809814 } ) ;
810815
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+
811840 } ) ;
812841
813842} ) ;
0 commit comments