@@ -263,6 +263,58 @@ describe("initSandboxRuntimeModular", () => {
263263 expect ( video . currentTime ) . toBe ( 9 ) ;
264264 } ) ;
265265
266+ it ( "updates visibility for timed elements inside nested compositions" , ( ) => {
267+ const root = document . createElement ( "div" ) ;
268+ root . setAttribute ( "data-composition-id" , "main" ) ;
269+ root . setAttribute ( "data-root" , "true" ) ;
270+ root . setAttribute ( "data-start" , "0" ) ;
271+ root . setAttribute ( "data-width" , "1920" ) ;
272+ root . setAttribute ( "data-height" , "1080" ) ;
273+ document . body . appendChild ( root ) ;
274+
275+ const child = document . createElement ( "div" ) ;
276+ child . setAttribute ( "data-composition-id" , "nested" ) ;
277+ child . setAttribute ( "data-start" , "10" ) ;
278+ child . setAttribute ( "data-duration" , "10" ) ;
279+ root . appendChild ( child ) ;
280+
281+ const sceneA = document . createElement ( "section" ) ;
282+ sceneA . id = "scene-a" ;
283+ sceneA . setAttribute ( "data-start" , "0" ) ;
284+ sceneA . setAttribute ( "data-duration" , "4" ) ;
285+ child . appendChild ( sceneA ) ;
286+
287+ const sceneB = document . createElement ( "section" ) ;
288+ sceneB . id = "scene-b" ;
289+ sceneB . setAttribute ( "data-start" , "4" ) ;
290+ sceneB . setAttribute ( "data-duration" , "4" ) ;
291+ child . appendChild ( sceneB ) ;
292+
293+ ( window as Window & { __timelines ?: Record < string , RuntimeTimelineLike > } ) . __timelines = {
294+ main : createMockTimeline ( 20 ) ,
295+ nested : createMockTimeline ( 8 ) ,
296+ } ;
297+
298+ initSandboxRuntimeModular ( ) ;
299+
300+ const player = (
301+ window as Window & {
302+ __player ?: { seek : ( timeSeconds : number ) => void } ;
303+ }
304+ ) . __player ;
305+ expect ( player ) . toBeDefined ( ) ;
306+
307+ player ?. seek ( 11 ) ;
308+
309+ expect ( sceneA . style . visibility ) . toBe ( "visible" ) ;
310+ expect ( sceneB . style . visibility ) . toBe ( "hidden" ) ;
311+
312+ player ?. seek ( 15 ) ;
313+
314+ expect ( sceneA . style . visibility ) . toBe ( "hidden" ) ;
315+ expect ( sceneB . style . visibility ) . toBe ( "visible" ) ;
316+ } ) ;
317+
266318 it ( "clamps nested media to the authored host window on seek" , ( ) => {
267319 const root = document . createElement ( "div" ) ;
268320 root . setAttribute ( "data-composition-id" , "main" ) ;
0 commit comments