@@ -6,13 +6,11 @@ import {BrowserDynamicTestingModule, platformBrowserDynamicTesting}
6
6
from '@angular/platform-browser-dynamic/testing' ;
7
7
import { MatTooltipModule } from '@angular/material/tooltip' ;
8
8
import { TooltipHarnessExample } from './tooltip-harness-example' ;
9
- import { Platform } from '@angular/cdk/platform' ;
10
9
import { NoopAnimationsModule } from '@angular/platform-browser/animations' ;
11
10
12
11
describe ( 'TooltipHarnessExample' , ( ) => {
13
12
let fixture : ComponentFixture < TooltipHarnessExample > ;
14
13
let loader : HarnessLoader ;
15
- let isSupported : boolean ;
16
14
17
15
beforeAll ( ( ) => {
18
16
TestBed . initTestEnvironment ( BrowserDynamicTestingModule , platformBrowserDynamicTesting ( ) ) ;
@@ -27,36 +25,22 @@ describe('TooltipHarnessExample', () => {
27
25
fixture = TestBed . createComponent ( TooltipHarnessExample ) ;
28
26
fixture . detectChanges ( ) ;
29
27
loader = TestbedHarnessEnvironment . loader ( fixture ) ;
30
- const platform = TestBed . inject ( Platform ) ;
31
- isSupported = ! platform . IOS && ! platform . ANDROID ;
32
28
} )
33
29
) ;
34
30
35
31
it ( 'should load all tooltip harnesses' , async ( ) => {
36
- if ( ! isSupported ) {
37
- return ;
38
- }
39
-
40
32
const tooltips = await loader . getAllHarnesses ( MatTooltipHarness ) ;
41
33
expect ( tooltips . length ) . toBe ( 2 ) ;
42
34
} ) ;
43
35
44
36
it ( 'should be able to show a tooltip' , async ( ) => {
45
- if ( ! isSupported ) {
46
- return ;
47
- }
48
-
49
37
const tooltip = await loader . getHarness ( MatTooltipHarness . with ( { selector : '#one' } ) ) ;
50
38
expect ( await tooltip . isOpen ( ) ) . toBe ( false ) ;
51
39
await tooltip . show ( ) ;
52
40
expect ( await tooltip . isOpen ( ) ) . toBe ( true ) ;
53
41
} ) ;
54
42
55
43
it ( 'should be able to hide a tooltip' , async ( ) => {
56
- if ( ! isSupported ) {
57
- return ;
58
- }
59
-
60
44
const tooltip = await loader . getHarness ( MatTooltipHarness . with ( { selector : '#one' } ) ) ;
61
45
expect ( await tooltip . isOpen ( ) ) . toBe ( false ) ;
62
46
await tooltip . show ( ) ;
@@ -66,20 +50,12 @@ describe('TooltipHarnessExample', () => {
66
50
} ) ;
67
51
68
52
it ( 'should be able to get the text of a tooltip' , async ( ) => {
69
- if ( ! isSupported ) {
70
- return ;
71
- }
72
-
73
53
const tooltip = await loader . getHarness ( MatTooltipHarness . with ( { selector : '#one' } ) ) ;
74
54
await tooltip . show ( ) ;
75
55
expect ( await tooltip . getTooltipText ( ) ) . toBe ( 'Tooltip message' ) ;
76
56
} ) ;
77
57
78
58
it ( 'should return empty when getting the tooltip text while closed' , async ( ) => {
79
- if ( ! isSupported ) {
80
- return ;
81
- }
82
-
83
59
const tooltip = await loader . getHarness ( MatTooltipHarness . with ( { selector : '#one' } ) ) ;
84
60
expect ( await tooltip . getTooltipText ( ) ) . toBe ( '' ) ;
85
61
} ) ;
0 commit comments