@@ -38,10 +38,9 @@ const containerDimensions = {
38
38
} ;
39
39
40
40
// Reset JSDom's default margin on the body
41
- document . body . style . margin = 0 ;
41
+ document . body . style . margin = '0' ;
42
42
43
- function createElementWithDimensions ( elemName , dimensions , margins ) {
44
- margins = margins || { } ;
43
+ function createElementWithDimensions ( elemName , dimensions , margins = { } ) {
45
44
let elem = document . createElement ( elemName ) ;
46
45
47
46
Object . assign ( elem . style , {
@@ -103,7 +102,7 @@ describe('calculatePosition', function () {
103
102
const placementAxis = placement . split ( ' ' ) [ 0 ] ;
104
103
105
104
// The tests are all based on top/left positioning. Convert to bottom/right positioning if needed.
106
- let pos = { } ;
105
+ let pos : { right ?: number , top ?: number , left ?: number , bottom ?: number } = { } ;
107
106
if ( ( placementAxis === 'left' && ! flip ) || ( placementAxis === 'right' && flip ) ) {
108
107
pos . right = boundaryDimensions . width - ( expected [ 0 ] + overlaySize . width ) ;
109
108
pos . top = expected [ 1 ] ;
@@ -164,7 +163,7 @@ describe('calculatePosition', function () {
164
163
} ) ;
165
164
}
166
165
167
- function checkPosition ( placement , targetDimension , expected , offset = 0 , crossOffset = 0 , flip = false , providerOffset , arrowSize , arrowBoundaryOffset ) {
166
+ function checkPosition ( placement , targetDimension , expected , offset = 0 , crossOffset = 0 , flip = false , providerOffset = undefined , arrowSize = undefined , arrowBoundaryOffset = undefined ) {
168
167
checkPositionCommon (
169
168
'Should calculate the correct position' ,
170
169
expected ,
@@ -396,7 +395,7 @@ describe('calculatePosition', function () {
396
395
const overlayNode = document . createElement ( 'div' ) ;
397
396
const container = document . createElement ( 'div' ) ;
398
397
399
- target . style = 'margin: 20px' ;
398
+ target . style . margin = '20px' ;
400
399
document . body . appendChild ( target ) ;
401
400
402
401
let { position : { top : positionTop } } = calculatePosition ( {
@@ -408,7 +407,8 @@ describe('calculatePosition', function () {
408
407
shouldFlip : false ,
409
408
boundaryElement : container ,
410
409
offset : 0 ,
411
- crossOffset : 0
410
+ crossOffset : 0 ,
411
+ arrowSize : 0
412
412
} ) ;
413
413
expect ( positionTop ) . toBe ( 0 ) ;
414
414
0 commit comments