File tree Expand file tree Collapse file tree 1 file changed +16
-24
lines changed
packages/0/src/composables/createVirtual Expand file tree Collapse file tree 1 file changed +16
-24
lines changed Original file line number Diff line number Diff line change @@ -57,30 +57,22 @@ describe('createVirtual', () => {
5757 return mockObserver
5858 } ) as unknown as typeof ResizeObserver
5959
60- let scrollTopValue = 0
61- mockContainer = {
62- get scrollTop ( ) {
63- return scrollTopValue
64- } ,
65- set scrollTop ( value : number ) {
66- scrollTopValue = value
67- } ,
68- scrollHeight : 5000 ,
69- clientHeight : 500 ,
70- offsetHeight : 500 ,
71- scrollTo : vi . fn ( ) ,
72- getBoundingClientRect : vi . fn ( ( ) => ( {
73- width : 400 ,
74- height : 500 ,
75- top : 0 ,
76- left : 0 ,
77- right : 400 ,
78- bottom : 500 ,
79- x : 0 ,
80- y : 0 ,
81- toJSON : ( ) => ( { } ) ,
82- } ) ) ,
83- } as unknown as HTMLElement
60+ mockContainer = realDocument . createElement ( 'div' )
61+ Object . defineProperty ( mockContainer , 'scrollHeight' , { value : 5000 , writable : true } )
62+ Object . defineProperty ( mockContainer , 'clientHeight' , { value : 500 , writable : true } )
63+ Object . defineProperty ( mockContainer , 'offsetHeight' , { value : 500 , writable : true } )
64+ mockContainer . scrollTo = vi . fn ( ) as any
65+ mockContainer . getBoundingClientRect = vi . fn ( ( ) => ( {
66+ width : 400 ,
67+ height : 500 ,
68+ top : 0 ,
69+ left : 0 ,
70+ right : 400 ,
71+ bottom : 500 ,
72+ x : 0 ,
73+ y : 0 ,
74+ toJSON : ( ) => ( { } ) ,
75+ } ) )
8476
8577 globalThis . window = {
8678 innerHeight : 800 ,
You can’t perform that action at this time.
0 commit comments