@@ -54,7 +54,8 @@ describe('MatTooltip', () => {
5454 ScrollableTooltipDemo ,
5555 OnPushTooltipDemo ,
5656 DynamicTooltipsDemo ,
57- TooltipOnTextFields
57+ TooltipOnTextFields ,
58+ TooltipOnDraggableElement ,
5859 ] ,
5960 providers : [
6061 { provide : Platform , useFactory : ( ) => platform } ,
@@ -795,6 +796,15 @@ describe('MatTooltip', () => {
795796 expect ( instance . textarea . nativeElement . style . userSelect ) . toBeFalsy ( ) ;
796797 expect ( instance . textarea . nativeElement . style . webkitUserSelect ) . toBeFalsy ( ) ;
797798 } ) ;
799+
800+ it ( 'should clear the `-webkit-user-drag` on draggable elements' , ( ) => {
801+ const fixture = TestBed . createComponent ( TooltipOnDraggableElement ) ;
802+
803+ fixture . detectChanges ( ) ;
804+
805+ expect ( fixture . componentInstance . button . nativeElement . style . webkitUserDrag ) . toBeFalsy ( ) ;
806+ } ) ;
807+
798808 } ) ;
799809
800810} ) ;
@@ -900,6 +910,20 @@ class TooltipOnTextFields {
900910 @ViewChild ( 'textarea' ) textarea : ElementRef ;
901911}
902912
913+ @Component ( {
914+ template : `
915+ <button
916+ #button
917+ style="-webkit-user-drag: none;"
918+ draggable="true"
919+ matTooltip="Drag me"></button>
920+ ` ,
921+ } )
922+ class TooltipOnDraggableElement {
923+ @ViewChild ( 'button' ) button : ElementRef ;
924+ }
925+
926+
903927/** Asserts whether a tooltip directive has a tooltip instance. */
904928function assertTooltipInstance ( tooltip : MatTooltip , shouldExist : boolean ) : void {
905929 // Note that we have to cast this to a boolean, because Jasmine will go into an infinite loop
0 commit comments