File tree Expand file tree Collapse file tree 6 files changed +22
-21
lines changed
Expand file tree Collapse file tree 6 files changed +22
-21
lines changed Original file line number Diff line number Diff line change @@ -105,6 +105,21 @@ class ClassUnderTest extends BaseGrid<TestPanel> {
105105}
106106
107107describe ( 'baseComponentGridview' , ( ) => {
108+ test ( 'that the container is not removed when grid is disposed' , ( ) => {
109+ const root = document . createElement ( 'div' ) ;
110+ const container = document . createElement ( 'div' ) ;
111+ root . appendChild ( container ) ;
112+
113+ const cut = new ClassUnderTest ( container , {
114+ orientation : Orientation . HORIZONTAL ,
115+ proportionalLayout : true ,
116+ } ) ;
117+
118+ cut . dispose ( ) ;
119+
120+ expect ( container . parentElement ) . toBe ( root ) ;
121+ } ) ;
122+
108123 test ( 'that .layout(...) force flag works' , ( ) => {
109124 const cut = new ClassUnderTest ( document . createElement ( 'div' ) , {
110125 orientation : Orientation . HORIZONTAL ,
Original file line number Diff line number Diff line change @@ -156,13 +156,15 @@ export abstract class BaseGrid<T extends IGridPanelView>
156156 }
157157
158158 constructor ( parentElement : HTMLElement , options : BaseGridOptions ) {
159- super ( parentElement , options . disableAutoResizing ) ;
159+ super ( document . createElement ( 'div' ) , options . disableAutoResizing ) ;
160160 this . element . style . height = '100%' ;
161161 this . element . style . width = '100%' ;
162162
163163 this . _classNames = new Classnames ( this . element ) ;
164164 this . _classNames . setClassNames ( options . className ?? '' ) ;
165165
166+ parentElement . appendChild ( this . element ) ;
167+
166168 this . gridview = new Gridview (
167169 ! ! options . proportionalLayout ,
168170 options . styles ,
Original file line number Diff line number Diff line change @@ -318,11 +318,7 @@ export const DockviewReact = React.forwardRef(
318318 } , [ props . prefixHeaderActionsComponent ] ) ;
319319
320320 return (
321- < div
322- className = { props . className }
323- style = { { height : '100%' , width : '100%' } }
324- ref = { domRef }
325- >
321+ < div style = { { height : '100%' , width : '100%' } } ref = { domRef } >
326322 { portals }
327323 </ div >
328324 ) ;
Original file line number Diff line number Diff line change @@ -126,11 +126,7 @@ export const GridviewReact = React.forwardRef(
126126 } , [ props . components ] ) ;
127127
128128 return (
129- < div
130- className = { props . className }
131- style = { { height : '100%' , width : '100%' } }
132- ref = { domRef }
133- >
129+ < div style = { { height : '100%' , width : '100%' } } ref = { domRef } >
134130 { portals }
135131 </ div >
136132 ) ;
Original file line number Diff line number Diff line change @@ -176,11 +176,7 @@ export const PaneviewReact = React.forwardRef(
176176 } , [ props . onDidDrop ] ) ;
177177
178178 return (
179- < div
180- className = { props . className }
181- style = { { height : '100%' , width : '100%' } }
182- ref = { domRef }
183- >
179+ < div style = { { height : '100%' , width : '100%' } } ref = { domRef } >
184180 { portals }
185181 </ div >
186182 ) ;
Original file line number Diff line number Diff line change @@ -126,11 +126,7 @@ export const SplitviewReact = React.forwardRef(
126126 } , [ props . components ] ) ;
127127
128128 return (
129- < div
130- className = { props . className }
131- style = { { height : '100%' , width : '100%' } }
132- ref = { domRef }
133- >
129+ < div style = { { height : '100%' , width : '100%' } } ref = { domRef } >
134130 { portals }
135131 </ div >
136132 ) ;
You can’t perform that action at this time.
0 commit comments