@@ -77,6 +77,13 @@ test.describe("scroll()", () => {
7777 await page . goto ( "scroll/scroll-stagger.html" )
7878 await page . reload ( )
7979
80+ // Record the initial bounding box x for each box
81+ const initialXs : number [ ] = [ ]
82+ await eachStaggerBox ( page , async ( box ) => {
83+ const boundingBox = await box . boundingBox ( )
84+ initialXs . push ( boundingBox ?. x ?? 0 )
85+ } )
86+
8087 // Get the total scroll height (400vh)
8188 const totalScrollHeight = await page . evaluate ( ( ) => {
8289 return document . documentElement . scrollHeight - window . innerHeight
@@ -90,10 +97,12 @@ test.describe("scroll()", () => {
9097 // Wait for animations to complete
9198 await page . waitForTimeout ( 100 )
9299
93- // At the bottom, all boxes should be at 100px translateX regardless of stagger
100+ // At the bottom, all boxes should be at 100px translateX from their initial position regardless of stagger
101+ let i = 0
94102 await eachStaggerBox ( page , async ( box ) => {
95103 const boundingBox = await box . boundingBox ( )
96- expect ( boundingBox ?. x ) . toBeCloseTo ( 100 , 1 )
104+ const initialX = initialXs [ i ++ ]
105+ expect ( boundingBox ?. x ) . toBeCloseTo ( initialX + 100 , 1 )
97106 } )
98107 } )
99108} )
0 commit comments