File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -823,7 +823,7 @@ function deletePosition(
823823 const parentCoords =
824824 ! animations . has ( el ) || animations . get ( el ) ?. playState === "finished"
825825 ? getCoords ( offsetParent )
826- : coords . get ( offsetParent ) !
826+ : coords . get ( offsetParent ) ?? getCoords ( offsetParent )
827827
828828 const top =
829829 Math . round ( oldCoords . top - parentCoords . top ) -
Original file line number Diff line number Diff line change 1+ import { test , expect } from '@playwright/test'
2+ import { fileURLToPath } from 'node:url'
3+
4+ const fixtureUrl = `/@fs${ fileURLToPath ( new URL ( '../fixtures/removal.html' , import . meta. url ) ) } `
5+ const moduleUrl = `/@fs${ fileURLToPath ( new URL ( '../../src/index.ts' , import . meta. url ) ) } `
6+
7+ test ( 'removes a table row during its entry animation' , async ( { page } ) => {
8+ const errors : string [ ] = [ ]
9+ page . on ( 'pageerror' , error => errors . push ( error . message ) )
10+ await page . goto ( fixtureUrl )
11+ await page . evaluate ( async moduleUrl => {
12+ const { default : autoAnimate } = await import ( moduleUrl )
13+ const rows = document . querySelector ( 'tbody' ) !
14+ autoAnimate ( rows )
15+ const row = rows . insertRow ( )
16+ row . id = 'removed'
17+ row . insertCell ( ) . textContent = 'Remove this row'
18+ } , moduleUrl )
19+ await page . waitForFunction ( ( ) =>
20+ document . querySelector ( '#removed' ) ! . getAnimations ( ) . some ( a => a . playState === 'running' )
21+ )
22+ const wasAnimating = await page . locator ( '#removed' ) . evaluate ( async row => {
23+ const running = row . getAnimations ( ) . some ( a => a . playState === 'running' )
24+ row . remove ( )
25+ await new Promise ( requestAnimationFrame )
26+ return running
27+ } )
28+ expect ( wasAnimating ) . toBe ( true )
29+ expect ( errors ) . toEqual ( [ ] )
30+ await expect ( page . locator ( '#removed' ) ) . toHaveCount ( 0 )
31+ await expect ( page . locator ( '#survivor' ) ) . toHaveCount ( 1 )
32+ } )
Original file line number Diff line number Diff line change 1+ <!doctype html>
2+ < html lang ="en ">
3+ < head > < meta charset ="utf-8 "> < title > Table row removal</ title > </ head >
4+ < body >
5+ < div style ="position: relative ">
6+ < table >
7+ < tbody > < tr id ="survivor "> < td > Keep this row</ td > </ tr > </ tbody >
8+ </ table >
9+ </ div >
10+ </ body >
11+ </ html >
You can’t perform that action at this time.
0 commit comments