File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -73,8 +73,8 @@ export interface DrawerPopupProps extends DrawerPanelEvents {
7373 | boolean
7474 | {
7575 onResize ?: ( size : number ) => void
76- onResizeStart ?: ( ) => void
77- onResizeEnd ?: ( ) => void
76+ onResizeStart ?: ( size : number ) => void
77+ onResizeEnd ?: ( size : number ) => void
7878 }
7979
8080}
@@ -215,8 +215,8 @@ const DrawerPopup = defineComponent<DrawerPopupProps>(
215215 containerRef : wrapperRef ,
216216 currentSize : mergedSize ,
217217 onResize : onInternalResize ,
218- onResizeStart : ( ) => resizeConfig ?. value ?. onResizeStart ?.( ) ,
219- onResizeEnd : ( ) => resizeConfig ?. value ?. onResizeEnd ?.( ) ,
218+ onResizeStart : size => resizeConfig ?. value ?. onResizeStart ?.( size ) ,
219+ onResizeEnd : size => resizeConfig ?. value ?. onResizeEnd ?.( size ) ,
220220 } )
221221 return ( ) => {
222222 const {
Original file line number Diff line number Diff line change @@ -44,6 +44,41 @@ describe('vc-drawer', () => {
4444 await nextTick ( )
4545 } )
4646
47+ it ( 'reports drawer sizes when resize starts and ends' , async ( ) => {
48+ const onResizeStart = vi . fn ( )
49+ const onResizeEnd = vi . fn ( )
50+ const wrapper = mount ( Drawer , {
51+ props : {
52+ open : true ,
53+ getContainer : false ,
54+ placement : 'right' ,
55+ defaultSize : 320 ,
56+ resizable : {
57+ onResizeStart,
58+ onResizeEnd,
59+ } ,
60+ ...motionProps ,
61+ } ,
62+ } )
63+
64+ await nextTick ( )
65+ const contentWrapper = wrapper . find ( '.vc-drawer-content-wrapper' ) . element as HTMLElement
66+ contentWrapper . getBoundingClientRect = vi . fn ( ( ) => ( {
67+ width : 360 ,
68+ height : 0 ,
69+ } as DOMRect ) )
70+
71+ await wrapper . find ( '.vc-drawer-resizable-dragger' ) . trigger ( 'mousedown' , { clientX : 100 } )
72+ await nextTick ( )
73+ document . dispatchEvent ( new MouseEvent ( 'mouseup' ) )
74+
75+ expect ( onResizeStart ) . toHaveBeenCalledWith ( 320 )
76+ expect ( onResizeEnd ) . toHaveBeenCalledWith ( 360 )
77+
78+ wrapper . unmount ( )
79+ await nextTick ( )
80+ } )
81+
4782 it ( 'closes on Escape when getContainer is false' , async ( ) => {
4883 const onClose = vi . fn ( )
4984 const wrapper = mount ( Drawer , {
You can’t perform that action at this time.
0 commit comments