@@ -4,26 +4,16 @@ import {StyleModule} from './index';
4
4
import { By } from '@angular/platform-browser' ;
5
5
import { TAB } from '../keyboard/keycodes' ;
6
6
import { FocusOriginMonitor } from './focus-classes' ;
7
- import { PlatformModule } from '../platform/index' ;
8
- import { Platform } from '../platform/platform' ;
9
7
10
-
11
- // NOTE: Firefox only fires focus & blur events when it is the currently active window.
12
- // This is not always the case on our CI setup, therefore we disable tests that depend on these
13
- // events firing for Firefox. We may be able to fix this by configuring our CI to start Firefox with
14
- // the following preference: focusmanager.testmode = true
15
-
16
-
17
- describe ( 'FocusOriginMonitor' , ( ) => {
8
+ fdescribe ( 'FocusOriginMonitor' , ( ) => {
18
9
let fixture : ComponentFixture < PlainButton > ;
19
10
let buttonElement : HTMLElement ;
20
11
let buttonRenderer : Renderer ;
21
12
let focusOriginMonitor : FocusOriginMonitor ;
22
- let platform : Platform ;
23
13
24
14
beforeEach ( async ( ( ) => {
25
15
TestBed . configureTestingModule ( {
26
- imports : [ StyleModule , PlatformModule ] ,
16
+ imports : [ StyleModule ] ,
27
17
declarations : [
28
18
PlainButton ,
29
19
] ,
@@ -32,21 +22,18 @@ describe('FocusOriginMonitor', () => {
32
22
TestBed . compileComponents ( ) ;
33
23
} ) ) ;
34
24
35
- beforeEach ( inject ( [ FocusOriginMonitor , Platform ] , ( fom : FocusOriginMonitor , pfm : Platform ) => {
25
+ beforeEach ( inject ( [ FocusOriginMonitor ] , ( fom : FocusOriginMonitor ) => {
36
26
fixture = TestBed . createComponent ( PlainButton ) ;
37
27
fixture . detectChanges ( ) ;
38
28
39
29
buttonElement = fixture . debugElement . query ( By . css ( 'button' ) ) . nativeElement ;
40
30
buttonRenderer = fixture . componentInstance . renderer ;
41
31
focusOriginMonitor = fom ;
42
- platform = pfm ;
43
32
44
33
focusOriginMonitor . registerElementForFocusClasses ( buttonElement , buttonRenderer ) ;
45
34
} ) ) ;
46
35
47
36
it ( 'manually registered element should receive focus classes' , async ( ( ) => {
48
- if ( platform . FIREFOX ) { return ; }
49
-
50
37
buttonElement . focus ( ) ;
51
38
fixture . detectChanges ( ) ;
52
39
@@ -59,8 +46,6 @@ describe('FocusOriginMonitor', () => {
59
46
} ) ) ;
60
47
61
48
it ( 'should detect focus via keyboard' , async ( ( ) => {
62
- if ( platform . FIREFOX ) { return ; }
63
-
64
49
// Simulate focus via keyboard.
65
50
dispatchKeydownEvent ( document , TAB ) ;
66
51
buttonElement . focus ( ) ;
@@ -79,8 +64,6 @@ describe('FocusOriginMonitor', () => {
79
64
} ) ) ;
80
65
81
66
it ( 'should detect focus via mouse' , async ( ( ) => {
82
- if ( platform . FIREFOX ) { return ; }
83
-
84
67
// Simulate focus via mouse.
85
68
dispatchMousedownEvent ( document ) ;
86
69
buttonElement . focus ( ) ;
@@ -99,8 +82,6 @@ describe('FocusOriginMonitor', () => {
99
82
} ) ) ;
100
83
101
84
it ( 'should detect programmatic focus' , async ( ( ) => {
102
- if ( platform . FIREFOX ) { return ; }
103
-
104
85
// Programmatically focus.
105
86
buttonElement . focus ( ) ;
106
87
fixture . detectChanges ( ) ;
@@ -118,8 +99,6 @@ describe('FocusOriginMonitor', () => {
118
99
} ) ) ;
119
100
120
101
it ( 'focusVia keyboard should simulate keyboard focus' , async ( ( ) => {
121
- if ( platform . FIREFOX ) { return ; }
122
-
123
102
focusOriginMonitor . focusVia ( buttonElement , buttonRenderer , 'keyboard' ) ;
124
103
fixture . detectChanges ( ) ;
125
104
@@ -136,8 +115,6 @@ describe('FocusOriginMonitor', () => {
136
115
} ) ) ;
137
116
138
117
it ( 'focusVia mouse should simulate mouse focus' , async ( ( ) => {
139
- if ( platform . FIREFOX ) { return ; }
140
-
141
118
focusOriginMonitor . focusVia ( buttonElement , buttonRenderer , 'mouse' ) ;
142
119
fixture . detectChanges ( ) ;
143
120
@@ -154,8 +131,6 @@ describe('FocusOriginMonitor', () => {
154
131
} ) ) ;
155
132
156
133
it ( 'focusVia program should simulate programmatic focus' , async ( ( ) => {
157
- if ( platform . FIREFOX ) { return ; }
158
-
159
134
focusOriginMonitor . focusVia ( buttonElement , buttonRenderer , 'program' ) ;
160
135
fixture . detectChanges ( ) ;
161
136
@@ -176,11 +151,10 @@ describe('FocusOriginMonitor', () => {
176
151
describe ( 'cdkFocusClasses' , ( ) => {
177
152
let fixture : ComponentFixture < ButtonWithFocusClasses > ;
178
153
let buttonElement : HTMLElement ;
179
- let platform : Platform ;
180
154
181
155
beforeEach ( async ( ( ) => {
182
156
TestBed . configureTestingModule ( {
183
- imports : [ StyleModule , PlatformModule ] ,
157
+ imports : [ StyleModule ] ,
184
158
declarations : [
185
159
ButtonWithFocusClasses ,
186
160
] ,
@@ -189,21 +163,18 @@ describe('cdkFocusClasses', () => {
189
163
TestBed . compileComponents ( ) ;
190
164
} ) ) ;
191
165
192
- beforeEach ( inject ( [ Platform ] , ( pfm : Platform ) => {
166
+ beforeEach ( ( ) => {
193
167
fixture = TestBed . createComponent ( ButtonWithFocusClasses ) ;
194
168
fixture . detectChanges ( ) ;
195
169
196
170
buttonElement = fixture . debugElement . query ( By . css ( 'button' ) ) . nativeElement ;
197
- platform = pfm ;
198
- } ) ) ;
171
+ } ) ;
199
172
200
173
it ( 'should initially not be focused' , ( ) => {
201
174
expect ( buttonElement . classList . length ) . toBe ( 0 , 'button should not have focus classes' ) ;
202
175
} ) ;
203
176
204
177
it ( 'should detect focus via keyboard' , async ( ( ) => {
205
- if ( platform . FIREFOX ) { return ; }
206
-
207
178
// Simulate focus via keyboard.
208
179
dispatchKeydownEvent ( document , TAB ) ;
209
180
buttonElement . focus ( ) ;
@@ -222,8 +193,6 @@ describe('cdkFocusClasses', () => {
222
193
} ) ) ;
223
194
224
195
it ( 'should detect focus via mouse' , async ( ( ) => {
225
- if ( platform . FIREFOX ) { return ; }
226
-
227
196
// Simulate focus via mouse.
228
197
dispatchMousedownEvent ( document ) ;
229
198
buttonElement . focus ( ) ;
@@ -242,8 +211,6 @@ describe('cdkFocusClasses', () => {
242
211
} ) ) ;
243
212
244
213
it ( 'should detect programmatic focus' , async ( ( ) => {
245
- if ( platform . FIREFOX ) { return ; }
246
-
247
214
// Programmatically focus.
248
215
buttonElement . focus ( ) ;
249
216
fixture . detectChanges ( ) ;
0 commit comments