@@ -94,6 +94,34 @@ window.__timelines["t"] = tl;`;
9494 timeline . kill ( ) ;
9595} ) ;
9696
97+ it ( "saves a dragged keyframe tween with its authored start, not the drag's live value" , ( ) => {
98+ const box = Object . assign ( document . body . appendChild ( document . createElement ( "div" ) ) , { id : "x" } ) ;
99+ const src = script (
100+ "keyframes: { '0%': { opacity: 0 }, '100%': { opacity: 1, x: 300 } }, duration: 1, ease: 'none'" ,
101+ ) . replace ( "}, 0);" , "}, 2);" ) ;
102+ const { timeline, iframe } = play ( src , 0.5 ) ;
103+ usePlayerStore . setState ( { currentTime : 0.5 , activeKeyframePct : null } ) ;
104+ gsap . set ( box , { x : 77 } ) ;
105+ const anim = parseGsapScriptAcorn ( src ) . animations [ 0 ] ! ;
106+ const selection = { id : "x" , selector : "#x" , element : box } as DomEditSelection ;
107+
108+ const plan = planValueEdit ( selection , anim , { x : 77 } , iframe ) ;
109+ timeline . kill ( ) ;
110+
111+ expect ( plan . ok ) . toBe ( true ) ;
112+ if ( ! plan . ok ) return ;
113+ const written = replaceTweenWithKeyframesInScript ( src , anim . id , plan . mutation ) ! ;
114+ const at = ( time : number ) => {
115+ const replay = play ( written , time ) ;
116+ const x = gsap . getProperty ( box , "x" ) ;
117+ replay . timeline . kill ( ) ;
118+ return x ;
119+ } ;
120+ expect ( at ( 0.5 ) ) . toBe ( 77 ) ;
121+ expect ( at ( 2 ) ) . toBe ( 0 ) ;
122+ expect ( at ( 3 ) ) . toBe ( 300 ) ;
123+ } ) ;
124+
97125it ( "names only an ease GSAP built in, and refuses a custom function rather than guess" , ( ) => {
98126 const custom = { vars : { ease : ( p : number ) => p * p } } ;
99127 const iframe = { contentWindow : { gsap } } as unknown as HTMLIFrameElement ;
0 commit comments