@@ -13,7 +13,7 @@ import { create as createAliases, IAliases } from '../cy/aliases'
13
13
import * as $Events from './events'
14
14
import { create as createEnsures , IEnsures } from '../cy/ensures'
15
15
import { create as createFocused , IFocused } from '../cy/focused'
16
- import $ Mouse from '../cy/mouse'
16
+ import { create as createMouse , Mouse } from '../cy/mouse'
17
17
import { Keyboard } from '../cy/keyboard'
18
18
import { create as createLocation , ILocation } from '../cy/location'
19
19
import { create as createAssertions , IAssertions } from '../cy/assertions'
@@ -124,6 +124,7 @@ class $Cy implements ITimeouts, IStability, IAssertions, IRetries, IJQuery, ILoc
124
124
config : any
125
125
devices : {
126
126
keyboard : Keyboard
127
+ mouse : Mouse
127
128
}
128
129
129
130
timeout : ITimeouts [ 'timeout' ]
@@ -141,7 +142,10 @@ class $Cy implements ITimeouts, IStability, IAssertions, IRetries, IJQuery, ILoc
141
142
142
143
getRemoteLocation : ILocation [ 'getRemoteLocation' ]
143
144
144
- // focused, keyboard, mouse
145
+ fireBlur : IFocused [ 'fireBlur' ]
146
+ fireFocus : IFocused [ 'fireFocus' ]
147
+ needsFocus : IFocused [ 'needsFocus' ]
148
+ getFocused : IFocused [ 'getFocused' ]
145
149
146
150
pauseTimers : ITimer [ 'pauseTimers' ]
147
151
@@ -178,11 +182,6 @@ class $Cy implements ITimeouts, IStability, IAssertions, IRetries, IJQuery, ILoc
178
182
detachDom : ISnapshots [ 'detachDom' ]
179
183
getStyles : ISnapshots [ 'getStyles' ]
180
184
181
- fireBlur : IFocused [ 'fireBlur' ]
182
- fireFocus : IFocused [ 'fireFocus' ]
183
- needsFocus : IFocused [ 'needsFocus' ]
184
- getFocused : IFocused [ 'getFocused' ]
185
-
186
185
// Private methods
187
186
resetTimer : ReturnType < typeof createTimer > [ 'reset' ]
188
187
@@ -205,10 +204,6 @@ class $Cy implements ITimeouts, IStability, IAssertions, IRetries, IJQuery, ILoc
205
204
this . config = config
206
205
initVideoRecorder ( Cypress )
207
206
208
- this . devices = {
209
- keyboard : new Keyboard ( state ) ,
210
- }
211
-
212
207
// bind methods
213
208
this . $$ = this . $$ . bind ( this )
214
209
@@ -245,7 +240,23 @@ class $Cy implements ITimeouts, IStability, IAssertions, IRetries, IJQuery, ILoc
245
240
246
241
this . getRemoteLocation = location . getRemoteLocation
247
242
248
- // focused, keyboard, mouse
243
+ const focused = createFocused ( state )
244
+
245
+ this . fireBlur = focused . fireBlur
246
+ this . fireFocus = focused . fireFocus
247
+ this . needsFocus = focused . needsFocus
248
+ this . getFocused = focused . getFocused
249
+
250
+ this . documentHasFocus = focused . documentHasFocus
251
+ this . interceptFocus = focused . interceptFocus
252
+ this . interceptBlur = focused . interceptBlur
253
+
254
+ const keyboard = new Keyboard ( state )
255
+
256
+ this . devices = {
257
+ keyboard,
258
+ mouse : createMouse ( state , keyboard , focused , Cypress ) ,
259
+ }
249
260
250
261
const timer = createTimer ( Cypress )
251
262
@@ -300,20 +311,6 @@ class $Cy implements ITimeouts, IStability, IAssertions, IRetries, IJQuery, ILoc
300
311
301
312
this . onCssModified = snapshots . onCssModified
302
313
this . onBeforeWindowLoad = snapshots . onBeforeWindowLoad
303
-
304
- const focused = createFocused ( state )
305
-
306
- this . fireBlur = focused . fireBlur
307
- this . fireFocus = focused . fireFocus
308
- this . needsFocus = focused . needsFocus
309
- this . getFocused = focused . getFocused
310
-
311
- this . documentHasFocus = focused . documentHasFocus
312
- this . interceptFocus = focused . interceptFocus
313
- this . interceptBlur = focused . interceptBlur
314
-
315
- // temporary -> should be removed
316
- this . focused = focused
317
314
}
318
315
319
316
$$ ( selector , context ) {
@@ -401,8 +398,6 @@ export default {
401
398
} )
402
399
}
403
400
404
- const mouse = $Mouse . create ( state , cy . devices . keyboard , cy . focused , Cypress )
405
-
406
401
const testConfigOverride = new TestConfigOverride ( )
407
402
408
403
const isStopped = ( ) => {
@@ -726,11 +721,6 @@ export default {
726
721
727
722
isStopped,
728
723
729
- devices : {
730
- mouse,
731
- keyboard : cy . devices . keyboard ,
732
- } ,
733
-
734
724
initialize ( $autIframe ) {
735
725
setRemoteIframeProps ( $autIframe , state )
736
726
0 commit comments