@@ -5,15 +5,10 @@ import {ComponentFixture, TestBed} from '@angular/core/testing';
5
5
import { MatTooltipModule } from '@angular/material/tooltip' ;
6
6
import { MatTooltipHarness } from '@angular/material/tooltip/testing/tooltip-harness' ;
7
7
import { NoopAnimationsModule } from '@angular/platform-browser/animations' ;
8
- import { Platform } from '@angular/cdk/platform' ;
9
8
10
9
/** Shared tests to run on both the original and MDC-based tooltips. */
11
10
export function runHarnessTests (
12
11
tooltipModule : typeof MatTooltipModule , tooltipHarness : typeof MatTooltipHarness ) {
13
- // TODO(COMP-322): whether the current test device is supported by the harness. At the time of
14
- // writing, we have to skip these tests on touch devices, because we don't have a way of
15
- // simulating touch events. This variable should be removed once the issue is resolved.
16
- let isSupported : boolean ;
17
12
let fixture : ComponentFixture < TooltipHarnessTest > ;
18
13
let loader : HarnessLoader ;
19
14
@@ -26,36 +21,21 @@ export function runHarnessTests(
26
21
fixture = TestBed . createComponent ( TooltipHarnessTest ) ;
27
22
fixture . detectChanges ( ) ;
28
23
loader = TestbedHarnessEnvironment . loader ( fixture ) ;
29
-
30
- const platform = TestBed . inject ( Platform ) ;
31
- isSupported = ! platform . IOS && ! platform . ANDROID ;
32
24
} ) ;
33
25
34
26
it ( 'should load all tooltip harnesses' , async ( ) => {
35
- if ( ! isSupported ) {
36
- return ;
37
- }
38
-
39
27
const tooltips = await loader . getAllHarnesses ( tooltipHarness ) ;
40
28
expect ( tooltips . length ) . toBe ( 2 ) ;
41
29
} ) ;
42
30
43
31
it ( 'should be able to show a tooltip' , async ( ) => {
44
- if ( ! isSupported ) {
45
- return ;
46
- }
47
-
48
32
const tooltip = await loader . getHarness ( tooltipHarness . with ( { selector : '#one' } ) ) ;
49
33
expect ( await tooltip . isOpen ( ) ) . toBe ( false ) ;
50
34
await tooltip . show ( ) ;
51
35
expect ( await tooltip . isOpen ( ) ) . toBe ( true ) ;
52
36
} ) ;
53
37
54
38
it ( 'should be able to hide a tooltip' , async ( ) => {
55
- if ( ! isSupported ) {
56
- return ;
57
- }
58
-
59
39
const tooltip = await loader . getHarness ( tooltipHarness . with ( { selector : '#one' } ) ) ;
60
40
expect ( await tooltip . isOpen ( ) ) . toBe ( false ) ;
61
41
await tooltip . show ( ) ;
@@ -65,20 +45,12 @@ export function runHarnessTests(
65
45
} ) ;
66
46
67
47
it ( 'should be able to get the text of a tooltip' , async ( ) => {
68
- if ( ! isSupported ) {
69
- return ;
70
- }
71
-
72
48
const tooltip = await loader . getHarness ( tooltipHarness . with ( { selector : '#one' } ) ) ;
73
49
await tooltip . show ( ) ;
74
50
expect ( await tooltip . getTooltipText ( ) ) . toBe ( 'Tooltip message' ) ;
75
51
} ) ;
76
52
77
53
it ( 'should return empty when getting the tooltip text while closed' , async ( ) => {
78
- if ( ! isSupported ) {
79
- return ;
80
- }
81
-
82
54
const tooltip = await loader . getHarness ( tooltipHarness . with ( { selector : '#one' } ) ) ;
83
55
expect ( await tooltip . getTooltipText ( ) ) . toBe ( '' ) ;
84
56
} ) ;
0 commit comments