@@ -14,24 +14,29 @@ import {
1414 getLeftCoord ,
1515 getRightCoord ,
1616} from "../getCoord" ;
17- import { HorizontalPosition } from "../types" ;
1817
19- const containerRect1 : ClientRect = {
18+ const containerRect1 : DOMRect = {
2019 left : 100 ,
2120 right : 50 ,
2221 top : 25 ,
2322 bottom : 75 ,
2423 height : 200 ,
2524 width : 100 ,
25+ x : 100 ,
26+ y : 25 ,
27+ toJSON ( ) { } ,
2628} ;
2729
28- const containerRect2 : ClientRect = {
30+ const containerRect2 : DOMRect = {
2931 left : 50 ,
3032 right : 100 ,
3133 top : 75 ,
3234 bottom : 25 ,
3335 height : 100 ,
3436 width : 200 ,
37+ x : 200 ,
38+ y : 75 ,
39+ toJSON ( ) { } ,
3540} ;
3641const config1 : FixConfig = {
3742 xMargin : 0 ,
@@ -83,10 +88,13 @@ const leftBoundsConfig1: FixConfig = {
8388 // pretending an icon button
8489 height : 40 ,
8590 width : 40 ,
91+ x : 0 ,
92+ y : 0 ,
93+ toJSON ( ) { } ,
8694 } ,
8795} ;
8896const leftBoundsConfig2 : FixConfig = { ...leftBoundsConfig1 , vwMargin : 8 } ;
89- const rightBoundsConfig1 = {
97+ const rightBoundsConfig1 : FixConfig = {
9098 xMargin : 0 ,
9199 vwMargin : 0 ,
92100 elWidth : 475 ,
@@ -101,9 +109,12 @@ const rightBoundsConfig1 = {
101109 // pretending an icon button
102110 height : 40 ,
103111 width : 40 ,
112+ x : vw - 40 ,
113+ y : 0 ,
114+ toJSON ( ) { } ,
104115 } ,
105116} ;
106- const rightBoundsConfig2 = { ...rightBoundsConfig1 , vwMargin : 8 } ;
117+ const rightBoundsConfig2 : FixConfig = { ...rightBoundsConfig1 , vwMargin : 8 } ;
107118
108119describe ( "createAnchoredLeft" , ( ) => {
109120 it ( "should return the calcualted left coord and an actualX value of left" , ( ) => {
@@ -481,7 +492,7 @@ describe("createAnchoredRight", () => {
481492 } ) ;
482493
483494 it ( "should return the left coord as the left value if the position can be swapped within the viewport" , ( ) => {
484- const config1 = {
495+ const config1 : FixConfig = {
485496 xMargin : 0 ,
486497 vwMargin : 0 ,
487498 elWidth : 50 ,
@@ -494,9 +505,12 @@ describe("createAnchoredRight", () => {
494505 right : 0 ,
495506 height : 40 ,
496507 width : 40 ,
508+ x : 160 ,
509+ y : 0 ,
510+ toJSON ( ) { } ,
497511 } ,
498512 } ;
499- const config2 = { ...config1 , xMargin : 8 } ;
513+ const config2 : FixConfig = { ...config1 , xMargin : 8 } ;
500514
501515 expect ( createAnchoredRight ( config2 ) ) . toEqual ( {
502516 left : getLeftCoord ( config2 ) ,
@@ -507,7 +521,7 @@ describe("createAnchoredRight", () => {
507521
508522describe ( "createEqualWidth" , ( ) => {
509523 const options1 = {
510- x : "center" as HorizontalPosition ,
524+ x : "center" ,
511525 vw : 1000 ,
512526 vwMargin : 0 ,
513527 xMargin : 0 ,
@@ -519,9 +533,12 @@ describe("createEqualWidth", () => {
519533 bottom : 200 ,
520534 height : 200 ,
521535 width : 400 ,
536+ x : 300 ,
537+ y : 0 ,
538+ toJSON ( ) { } ,
522539 } ,
523540 isMinWidth : false ,
524- } ;
541+ } as const ;
525542 const options2 = { ...options1 , vwMargin : 16 } ;
526543 const options3 = { ...options1 , xMargin : 5 } ;
527544 const options4 = { ...options2 , xMargin : 5 } ;
0 commit comments