@@ -247,91 +247,50 @@ describe('PageLayout', async () => {
247247 )
248248
249249 const pane = container . querySelector < HTMLElement > ( '[class*="Pane"][data-resizable]' )
250+ const content = container . querySelector < HTMLElement > ( '[class*="PageLayoutContent"]' )
250251 const divider = await screen . findByRole ( 'slider' )
251252
253+ // Mock offsetHeight for testing
254+ Object . defineProperty ( pane , 'offsetHeight' , {
255+ configurable : true ,
256+ value : 320 ,
257+ } )
258+ Object . defineProperty ( content , 'offsetHeight' , {
259+ configurable : true ,
260+ value : 640 ,
261+ } )
262+
252263 // Before drag - no containment
253264 expect ( pane ! . style . contain ) . toBe ( '' )
254265 expect ( pane ! . style . pointerEvents ) . toBe ( '' )
266+ expect ( pane ! . style . contentVisibility ) . toBe ( '' )
267+ expect ( pane ! . style . containIntrinsicSize ) . toBe ( '' )
268+ expect ( content ! . style . contain ) . toBe ( '' )
269+ expect ( content ! . style . pointerEvents ) . toBe ( '' )
270+ expect ( content ! . style . contentVisibility ) . toBe ( '' )
271+ expect ( content ! . style . containIntrinsicSize ) . toBe ( '' )
255272
256- // Start drag - containment is added
273+ // Start drag - containment and content-visibility are added to both pane and content
257274 fireEvent . pointerDown ( divider , { clientX : 300 , clientY : 200 , pointerId : 1 } )
258275 expect ( pane ! . style . contain ) . toBe ( 'layout style paint' )
259276 expect ( pane ! . style . pointerEvents ) . toBe ( 'none' )
277+ expect ( pane ! . style . contentVisibility ) . toBe ( 'auto' )
278+ expect ( pane ! . style . containIntrinsicSize ) . toBe ( 'auto 320px' )
279+ expect ( content ! . style . contain ) . toBe ( 'layout style paint' )
280+ expect ( content ! . style . pointerEvents ) . toBe ( 'none' )
281+ expect ( content ! . style . contentVisibility ) . toBe ( 'auto' )
282+ expect ( content ! . style . containIntrinsicSize ) . toBe ( 'auto 640px' )
260283
261284 // End drag - containment is removed
262285 fireEvent . lostPointerCapture ( divider , { pointerId : 1 } )
263286 expect ( pane ! . style . contain ) . toBe ( '' )
264287 expect ( pane ! . style . pointerEvents ) . toBe ( '' )
265- } )
266-
267- it ( 'should apply content-visibility only for tall content during drag' , async ( ) => {
268- const { container} = render (
269- < PageLayout >
270- < PageLayout . Pane resizable >
271- < Placeholder height = { 320 } label = "Pane" />
272- </ PageLayout . Pane >
273- < PageLayout . Content >
274- < Placeholder height = { 1200 } label = "Content" />
275- </ PageLayout . Content >
276- </ PageLayout > ,
277- )
278-
279- const content = container . querySelector < HTMLElement > ( '[class*="Content"]' )
280- const divider = await screen . findByRole ( 'slider' )
281-
282- // Mock offsetHeight for tall content (>1000px threshold)
283- Object . defineProperty ( content , 'offsetHeight' , {
284- configurable : true ,
285- value : 1200 ,
286- } )
287-
288- // Before drag - no content-visibility
289- expect ( content ! . style . contentVisibility ) . toBe ( '' )
290- expect ( content ! . style . containIntrinsicSize ) . toBe ( '' )
291-
292- // Start drag - content-visibility is added for tall content
293- fireEvent . pointerDown ( divider , { clientX : 300 , clientY : 200 , pointerId : 1 } )
294- expect ( content ! . style . contentVisibility ) . toBe ( 'auto' )
295- expect ( content ! . style . containIntrinsicSize ) . toBe ( 'auto 1200px' )
296-
297- // End drag - content-visibility is removed
298- fireEvent . lostPointerCapture ( divider , { pointerId : 1 } )
299- expect ( content ! . style . contentVisibility ) . toBe ( '' )
300- expect ( content ! . style . containIntrinsicSize ) . toBe ( '' )
301- } )
302-
303- it ( 'should not apply content-visibility for short content during drag' , async ( ) => {
304- const { container} = render (
305- < PageLayout >
306- < PageLayout . Pane resizable >
307- < Placeholder height = { 320 } label = "Pane" />
308- </ PageLayout . Pane >
309- < PageLayout . Content >
310- < Placeholder height = { 640 } label = "Content" />
311- </ PageLayout . Content >
312- </ PageLayout > ,
313- )
314-
315- const content = container . querySelector < HTMLElement > ( '[class*="Content"]' )
316- const divider = await screen . findByRole ( 'slider' )
317-
318- // Mock offsetHeight for short content (<1000px threshold)
319- Object . defineProperty ( content , 'offsetHeight' , {
320- configurable : true ,
321- value : 640 ,
322- } )
323-
324- // Start drag
325- fireEvent . pointerDown ( divider , { clientX : 300 , clientY : 200 , pointerId : 1 } )
326-
327- // content-visibility should NOT be applied for short content
288+ expect ( pane ! . style . contentVisibility ) . toBe ( '' )
289+ expect ( pane ! . style . containIntrinsicSize ) . toBe ( '' )
290+ expect ( content ! . style . contain ) . toBe ( '' )
291+ expect ( content ! . style . pointerEvents ) . toBe ( '' )
328292 expect ( content ! . style . contentVisibility ) . toBe ( '' )
329293 expect ( content ! . style . containIntrinsicSize ) . toBe ( '' )
330- // But basic containment should still be applied
331- expect ( content ! . style . contain ) . toBe ( 'layout style paint' )
332-
333- // End drag
334- fireEvent . lostPointerCapture ( divider , { pointerId : 1 } )
335294 } )
336295 } )
337296
0 commit comments