1
+ import { AnimationEvent } from '@angular/animations' ;
2
+ import { FocusMonitor } from '@angular/cdk/a11y' ;
3
+ import { Direction , Directionality } from '@angular/cdk/bidi' ;
4
+ import { ESCAPE } from '@angular/cdk/keycodes' ;
5
+ import { CdkScrollable , OverlayContainer , OverlayModule } from '@angular/cdk/overlay' ;
6
+ import { Platform } from '@angular/cdk/platform' ;
1
7
import {
2
- waitForAsync ,
3
- ComponentFixture ,
4
- fakeAsync ,
5
- flush ,
6
- flushMicrotasks ,
7
- inject ,
8
- TestBed ,
9
- tick
10
- } from '@angular/core/testing' ;
8
+ createFakeEvent ,
9
+ createKeyboardEvent ,
10
+ dispatchEvent ,
11
+ dispatchFakeEvent ,
12
+ dispatchKeyboardEvent ,
13
+ dispatchMouseEvent ,
14
+ patchElementFocus ,
15
+ } from '@angular/cdk/testing/private' ;
11
16
import {
12
17
ChangeDetectionStrategy ,
13
18
Component ,
14
19
DebugElement ,
15
20
ElementRef ,
16
- ViewChild ,
17
21
NgZone ,
22
+ ViewChild ,
18
23
} from '@angular/core' ;
19
- import { AnimationEvent } from '@angular/animations' ;
24
+ import {
25
+ ComponentFixture ,
26
+ fakeAsync ,
27
+ flush ,
28
+ flushMicrotasks ,
29
+ inject ,
30
+ TestBed ,
31
+ tick ,
32
+ waitForAsync
33
+ } from '@angular/core/testing' ;
20
34
import { By } from '@angular/platform-browser' ;
21
35
import { NoopAnimationsModule } from '@angular/platform-browser/animations' ;
22
- import { Direction , Directionality } from '@angular/cdk/bidi' ;
23
- import { OverlayContainer , OverlayModule , CdkScrollable } from '@angular/cdk/overlay' ;
24
- import { Platform } from '@angular/cdk/platform' ;
25
- import {
26
- dispatchFakeEvent ,
27
- dispatchKeyboardEvent ,
28
- patchElementFocus ,
29
- dispatchMouseEvent ,
30
- createKeyboardEvent ,
31
- dispatchEvent ,
32
- createFakeEvent ,
33
- } from '@angular/cdk/testing/private' ;
34
- import { ESCAPE } from '@angular/cdk/keycodes' ;
35
- import { FocusMonitor } from '@angular/cdk/a11y' ;
36
36
import {
37
+ MAT_TOOLTIP_DEFAULT_OPTIONS ,
37
38
MatTooltip ,
38
39
MatTooltipModule ,
39
40
SCROLL_THROTTLE_MS ,
40
- TOOLTIP_PANEL_CLASS ,
41
- MAT_TOOLTIP_DEFAULT_OPTIONS ,
42
- TooltipTouchGestures ,
43
41
TooltipPosition ,
42
+ TooltipTouchGestures ,
44
43
} from './index' ;
45
44
46
45
@@ -244,7 +243,7 @@ describe('MDC-based MatTooltip', () => {
244
243
const overlayRef = tooltipDirective . _overlayRef ;
245
244
246
245
expect ( ! ! overlayRef ) . toBeTruthy ( ) ;
247
- expect ( overlayRef ! . overlayElement . classList ) . toContain ( TOOLTIP_PANEL_CLASS ,
246
+ expect ( overlayRef ! . overlayElement . classList ) . toContain ( 'mat-mdc-tooltip-panel' ,
248
247
'Expected the overlay panel element to have the tooltip panel class set.' ) ;
249
248
} ) ) ;
250
249
@@ -695,7 +694,7 @@ describe('MDC-based MatTooltip', () => {
695
694
expect ( event . defaultPrevented ) . toBe ( false ) ;
696
695
} ) ) ;
697
696
698
- it ( 'should not show the tooltip on progammatic focus' , fakeAsync ( ( ) => {
697
+ it ( 'should not show the tooltip on programmatic focus' , fakeAsync ( ( ) => {
699
698
patchElementFocus ( buttonElement ) ;
700
699
assertTooltipInstance ( tooltipDirective , false ) ;
701
700
@@ -761,19 +760,19 @@ describe('MDC-based MatTooltip', () => {
761
760
setPositionAndShow ( 'below' ) ;
762
761
763
762
const classList = tooltipDirective . _overlayRef ! . overlayElement . classList ;
764
- expect ( classList ) . toContain ( 'mat-tooltip-panel-below' ) ;
763
+ expect ( classList ) . toContain ( 'mat-mdc- tooltip-panel-below' ) ;
765
764
766
765
setPositionAndShow ( 'above' ) ;
767
- expect ( classList ) . not . toContain ( 'mat-tooltip-panel-below' ) ;
768
- expect ( classList ) . toContain ( 'mat-tooltip-panel-above' ) ;
766
+ expect ( classList ) . not . toContain ( 'mat-mdc- tooltip-panel-below' ) ;
767
+ expect ( classList ) . toContain ( 'mat-mdc- tooltip-panel-above' ) ;
769
768
770
769
setPositionAndShow ( 'left' ) ;
771
- expect ( classList ) . not . toContain ( 'mat-tooltip-panel-above' ) ;
772
- expect ( classList ) . toContain ( 'mat-tooltip-panel-left' ) ;
770
+ expect ( classList ) . not . toContain ( 'mat-mdc- tooltip-panel-above' ) ;
771
+ expect ( classList ) . toContain ( 'mat-mdc- tooltip-panel-left' ) ;
773
772
774
773
setPositionAndShow ( 'right' ) ;
775
- expect ( classList ) . not . toContain ( 'mat-tooltip-panel-left' ) ;
776
- expect ( classList ) . toContain ( 'mat-tooltip-panel-right' ) ;
774
+ expect ( classList ) . not . toContain ( 'mat-mdc- tooltip-panel-left' ) ;
775
+ expect ( classList ) . toContain ( 'mat-mdc- tooltip-panel-right' ) ;
777
776
778
777
function setPositionAndShow ( position : TooltipPosition ) {
779
778
tooltipDirective . hide ( 0 ) ;
@@ -804,10 +803,10 @@ describe('MDC-based MatTooltip', () => {
804
803
tick ( 500 ) ;
805
804
806
805
const classList = tooltipDirective . _overlayRef ! . overlayElement . classList ;
807
- expect ( classList ) . not . toContain ( 'mat-tooltip-panel-after' ) ;
808
- expect ( classList ) . not . toContain ( 'mat-tooltip-panel-before' ) ;
809
- expect ( classList ) . not . toContain ( 'mat-tooltip-panel-left' ) ;
810
- expect ( classList ) . toContain ( 'mat-tooltip-panel-right' ) ;
806
+ expect ( classList ) . not . toContain ( 'mat-mdc- tooltip-panel-after' ) ;
807
+ expect ( classList ) . not . toContain ( 'mat-mdc- tooltip-panel-before' ) ;
808
+ expect ( classList ) . not . toContain ( 'mat-mdc- tooltip-panel-left' ) ;
809
+ expect ( classList ) . toContain ( 'mat-mdc- tooltip-panel-right' ) ;
811
810
812
811
tooltipDirective . hide ( 0 ) ;
813
812
fixture . detectChanges ( ) ;
@@ -819,10 +818,10 @@ describe('MDC-based MatTooltip', () => {
819
818
fixture . detectChanges ( ) ;
820
819
tick ( 500 ) ;
821
820
822
- expect ( classList ) . not . toContain ( 'mat-tooltip-panel-after' ) ;
823
- expect ( classList ) . not . toContain ( 'mat-tooltip-panel-before' ) ;
824
- expect ( classList ) . not . toContain ( 'mat-tooltip-panel-right' ) ;
825
- expect ( classList ) . toContain ( 'mat-tooltip-panel-left' ) ;
821
+ expect ( classList ) . not . toContain ( 'mat-mdc- tooltip-panel-after' ) ;
822
+ expect ( classList ) . not . toContain ( 'mat-mdc- tooltip-panel-before' ) ;
823
+ expect ( classList ) . not . toContain ( 'mat-mdc- tooltip-panel-right' ) ;
824
+ expect ( classList ) . toContain ( 'mat-mdc- tooltip-panel-left' ) ;
826
825
} ) ) ;
827
826
828
827
it ( 'should clear the show timeout on destroy' , fakeAsync ( ( ) => {
0 commit comments