@@ -22,11 +22,11 @@ export class Utilities {
22
22
return this . config ;
23
23
}
24
24
25
- isMacOs ( ) {
25
+ isMacOs ( ) : boolean {
26
26
return Cypress . platform === 'darwin' ;
27
27
}
28
28
29
- selectCell ( clientX : number , clientY : number , customEventArgs = undefined ) {
29
+ selectCell ( clientX : number , clientY : number , customEventArgs = undefined ) : void {
30
30
const scrollableElement = this . getScrollableElement ( ) ;
31
31
if ( customEventArgs !== undefined ) {
32
32
scrollableElement . trigger ( 'pointerdown' , clientX , clientY , { ...customEventArgs , pointerType : 'mouse' } ) ;
@@ -37,34 +37,35 @@ export class Utilities {
37
37
cy . wait ( 500 ) ;
38
38
}
39
39
40
- scrollTo ( left : number , top : number , duration = 500 ) {
41
- return this . getConfig ( ) . pinToBody ? cy . scrollTo ( left , top , { duration, ensureScrollable : true } ) :
42
- this . getScrollableElement ( ) . scrollTo ( left , top , { duration, ensureScrollable : true } ) ;
40
+ scrollTo ( left : number , top : number , duration = 500 ) : void {
41
+ this . getConfig ( ) . pinToBody
42
+ ? cy . scrollTo ( left , top , { duration, ensureScrollable : true } )
43
+ : this . getScrollableElement ( ) . scrollTo ( left , top , { duration, ensureScrollable : true } ) ;
43
44
}
44
45
45
- wait ( ) {
46
+ wait ( ) : number {
46
47
return this . isMacOs ( ) ? 50 : 100 ;
47
48
}
48
49
49
- scrollToBottom ( left = 0 ) {
50
+ scrollToBottom ( left = 0 ) : void {
50
51
const offset = this . getBottomAddtionalOffset ( true ) ;
51
- return this . scrollTo ( left , this . getConfig ( ) . rows * this . getConfig ( ) . cellHeight + offset ) ;
52
+ this . scrollTo ( left , this . getConfig ( ) . rows * this . getConfig ( ) . cellHeight + offset ) ;
52
53
}
53
54
54
- scrollToRight ( top = 0 ) {
55
+ scrollToRight ( top = 0 ) : void {
55
56
const offset = this . getRightAddtionalOffset ( ) ;
56
57
this . scrollTo ( this . getConfig ( ) . columns * this . getConfig ( ) . cellWidth + offset , top ) ;
57
58
}
58
59
59
- getCellXCenter ( ) {
60
+ getCellXCenter ( ) : number {
60
61
return this . getConfig ( ) . cellWidth / 2 ;
61
62
}
62
63
63
- getCellYCenter ( ) {
64
+ getCellYCenter ( ) : number {
64
65
return this . getConfig ( ) . cellHeight / 2 ;
65
66
}
66
67
67
- selectCellInEditMode ( clientX : number , clientY : number ) {
68
+ selectCellInEditMode ( clientX : number , clientY : number ) : void {
68
69
this . selectCell ( clientX , clientY ) ;
69
70
this . keyDown ( constants . keyCodes . Enter , { force : true } ) ;
70
71
}
@@ -79,12 +80,12 @@ export class Utilities {
79
80
return + ( Math . round ( ( ( value + "e+" + places ) as unknown ) as number ) + "e-" + places ) ;
80
81
}
81
82
82
- resetSelection ( x : number , y : number ) {
83
+ resetSelection ( x : number , y : number ) : void {
83
84
this . selectCell ( x , y + this . getConfig ( ) . cellHeight ) ;
84
85
this . selectCell ( x , y ) ;
85
86
}
86
87
87
- keyDown ( keyCode : number , customEventArgs ?: { } , timeout = 200 , log = true ) {
88
+ keyDown ( keyCode : number , customEventArgs ?: Record < string , unknown > , timeout = 200 , log = true ) : void {
88
89
const rg = this . getReactGridContent ( ) ;
89
90
if ( customEventArgs !== undefined ) {
90
91
rg . trigger ( 'keydown' , { ...customEventArgs , keyCode, log, force : true } ) ;
@@ -95,62 +96,62 @@ export class Utilities {
95
96
cy . wait ( timeout , { log } ) ;
96
97
}
97
98
98
- getCell ( x : number , y : number ) {
99
+ getCell ( x : number , y : number ) : Cypress . Chainable {
99
100
return cy . get ( `[data-cell-colidx=${ x } ][data-cell-rowidx=${ y } ]` ) . eq ( 0 ) ;
100
101
}
101
102
102
- getScrollableElement ( ) {
103
+ getScrollableElement ( ) : Cypress . Chainable {
103
104
// TODO is Body correct element for getting scroll and sroll view?
104
105
return this . config . pinToBody ? this . getBody ( ) : this . getDivScrollableElement ( ) ;
105
106
}
106
107
107
- getDivScrollableElement ( ) {
108
+ getDivScrollableElement ( ) : Cypress . Chainable {
108
109
return cy . get ( '.test-grid-container' ) ;
109
110
}
110
111
111
- getReactGrid ( ) {
112
+ getReactGrid ( ) : Cypress . Chainable {
112
113
return cy . get ( '.reactgrid' ) ;
113
114
}
114
115
115
- getReactGridContent ( ) {
116
+ getReactGridContent ( ) : Cypress . Chainable {
116
117
return cy . get ( '.reactgrid-content' ) ;
117
118
}
118
119
119
- getOuterInput ( ) {
120
+ getOuterInput ( ) : Cypress . Chainable {
120
121
return cy . get ( '[data-cy=outer-input]' ) ;
121
122
}
122
123
123
- getCellEditor ( ) {
124
+ getCellEditor ( ) : Cypress . Chainable {
124
125
return cy . get ( '.rg-celleditor' ) ;
125
126
}
126
127
127
- getBody ( ) {
128
+ getBody ( ) : Cypress . Chainable {
128
129
return cy . get ( 'body' ) ;
129
130
}
130
131
131
- getLeftStickyPane ( ) {
132
+ getLeftStickyPane ( ) : Cypress . Chainable {
132
133
return cy . get ( '.rg-pane-left' ) ;
133
134
}
134
135
135
- getTopStickyPane ( ) {
136
+ getTopStickyPane ( ) : Cypress . Chainable {
136
137
return cy . get ( '.rg-pane-top' ) ;
137
138
}
138
139
139
- getCellFocus ( ) {
140
+ getCellFocus ( ) : Cypress . Chainable {
140
141
const cell = cy . get ( '.rg-cell-focus' ) ;
141
142
cell . should ( 'exist' ) ;
142
143
return cell ;
143
144
}
144
145
145
- getCellHighlight ( ) {
146
+ getCellHighlight ( ) : Cypress . Chainable {
146
147
return cy . get ( '.rg-cell-highlight' ) ;
147
148
}
148
149
149
- getDropdownMenu ( ) {
150
+ getDropdownMenu ( ) : Cypress . Chainable {
150
151
return cy . get ( '.dropdown-menu' ) ;
151
152
}
152
153
153
- click ( x : number , y : number ) {
154
+ click ( x : number , y : number ) : void {
154
155
this . getScrollableElement ( ) . trigger ( 'pointerdown' , x , y , { pointerType : 'mouse' } ) ;
155
156
this . getBody ( ) . trigger ( 'pointerup' , 0 , 0 , { pointerType : 'mouse' , force : true } ) ; //
156
157
}
@@ -300,7 +301,7 @@ export class Utilities {
300
301
}
301
302
}
302
303
303
- assertIsReactGridFocused ( ) {
304
+ assertIsReactGridFocused ( ) : void {
304
305
cy . focused ( ) . should ( 'have.class' , 'rg-hidden-element' ) ;
305
306
}
306
307
@@ -339,7 +340,7 @@ export class Utilities {
339
340
}
340
341
}
341
342
342
- testCellEditor ( testCase : CellEditorTestParams ) {
343
+ testCellEditor ( testCase : CellEditorTestParams ) : void {
343
344
let test : CellEditorTestParams = this . setScrollValues ( testCase ) ;
344
345
test = this . moveClickPosByOnePixel ( test ) ;
345
346
this . scrollTo ( test . scroll . x , test . scroll . y ) ;
@@ -348,7 +349,7 @@ export class Utilities {
348
349
}
349
350
350
351
351
- testCellEditorOnSticky ( testCase : CellEditorTestParams ) {
352
+ testCellEditorOnSticky ( testCase : CellEditorTestParams ) : void {
352
353
let test : CellEditorTestParams = this . setScrollValues ( testCase ) ;
353
354
test = this . moveClickPosByOnePixel ( test ) ;
354
355
if ( this . getConfig ( ) . pinToBody ) {
0 commit comments