Commit 48d74f8 1 parent 872ec7c commit 48d74f8 Copy full SHA for 48d74f8
File tree 10 files changed +42
-33
lines changed
10 files changed +42
-33
lines changed Original file line number Diff line number Diff line change @@ -105,6 +105,21 @@ class ClassUnderTest extends BaseGrid<TestPanel> {
105
105
}
106
106
107
107
describe ( '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
+
108
123
test ( 'that .layout(...) force flag works' , ( ) => {
109
124
const cut = new ClassUnderTest ( document . createElement ( 'div' ) , {
110
125
orientation : Orientation . HORIZONTAL ,
Original file line number Diff line number Diff line change @@ -368,8 +368,8 @@ export class DockviewComponent
368
368
return this . _floatingGroups ;
369
369
}
370
370
371
- constructor ( parentElement : HTMLElement , options : DockviewComponentOptions ) {
372
- super ( parentElement , {
371
+ constructor ( container : HTMLElement , options : DockviewComponentOptions ) {
372
+ super ( container , {
373
373
proportionalLayout : true ,
374
374
orientation : Orientation . HORIZONTAL ,
375
375
styles : options . hideBorders
Original file line number Diff line number Diff line change @@ -155,14 +155,17 @@ export abstract class BaseGrid<T extends IGridPanelView>
155
155
this . gridview . locked = value ;
156
156
}
157
157
158
- constructor ( parentElement : HTMLElement , options : BaseGridOptions ) {
159
- super ( parentElement , options . disableAutoResizing ) ;
158
+ constructor ( container : HTMLElement , options : BaseGridOptions ) {
159
+ super ( document . createElement ( 'div' ) , options . disableAutoResizing ) ;
160
160
this . element . style . height = '100%' ;
161
161
this . element . style . width = '100%' ;
162
162
163
163
this . _classNames = new Classnames ( this . element ) ;
164
164
this . _classNames . setClassNames ( options . className ?? '' ) ;
165
165
166
+ // the container is owned by the third-party, do not modify/delete it
167
+ container . appendChild ( this . element ) ;
168
+
166
169
this . gridview = new Gridview (
167
170
! ! options . proportionalLayout ,
168
171
options . styles ,
Original file line number Diff line number Diff line change @@ -113,8 +113,8 @@ export class GridviewComponent
113
113
this . _deserializer = value ;
114
114
}
115
115
116
- constructor ( parentElement : HTMLElement , options : GridviewComponentOptions ) {
117
- super ( parentElement , {
116
+ constructor ( container : HTMLElement , options : GridviewComponentOptions ) {
117
+ super ( container , {
118
118
proportionalLayout : options . proportionalLayout ?? true ,
119
119
orientation : options . orientation ,
120
120
styles : options . hideBorders
Original file line number Diff line number Diff line change @@ -195,8 +195,10 @@ export class PaneviewComponent extends Resizable implements IPaneviewComponent {
195
195
return this . _options ;
196
196
}
197
197
198
- constructor ( parentElement : HTMLElement , options : PaneviewComponentOptions ) {
199
- super ( parentElement , options . disableAutoResizing ) ;
198
+ constructor ( container : HTMLElement , options : PaneviewComponentOptions ) {
199
+ super ( document . createElement ( 'div' ) , options . disableAutoResizing ) ;
200
+ this . element . style . height = '100%' ;
201
+ this . element . style . width = '100%' ;
200
202
201
203
this . addDisposables (
202
204
this . _onDidLayoutChange ,
@@ -210,6 +212,9 @@ export class PaneviewComponent extends Resizable implements IPaneviewComponent {
210
212
this . _classNames = new Classnames ( this . element ) ;
211
213
this . _classNames . setClassNames ( options . className ?? '' ) ;
212
214
215
+ // the container is owned by the third-party, do not modify/delete it
216
+ container . appendChild ( this . element ) ;
217
+
213
218
this . _options = options ;
214
219
215
220
this . paneview = new Paneview ( this . element , {
Original file line number Diff line number Diff line change @@ -155,15 +155,17 @@ export class SplitviewComponent
155
155
: this . splitview . orthogonalSize ;
156
156
}
157
157
158
- constructor (
159
- parentElement : HTMLElement ,
160
- options : SplitviewComponentOptions
161
- ) {
162
- super ( parentElement , options . disableAutoResizing ) ;
158
+ constructor ( container : HTMLElement , options : SplitviewComponentOptions ) {
159
+ super ( document . createElement ( 'div' ) , options . disableAutoResizing ) ;
160
+ this . element . style . height = '100%' ;
161
+ this . element . style . width = '100%' ;
163
162
164
163
this . _classNames = new Classnames ( this . element ) ;
165
164
this . _classNames . setClassNames ( options . className ?? '' ) ;
166
165
166
+ // the container is owned by the third-party, do not modify/delete it
167
+ container . appendChild ( this . element ) ;
168
+
167
169
this . _options = options ;
168
170
169
171
this . splitview = new Splitview ( this . element , options ) ;
Original file line number Diff line number Diff line change @@ -318,11 +318,7 @@ export const DockviewReact = React.forwardRef(
318
318
} , [ props . prefixHeaderActionsComponent ] ) ;
319
319
320
320
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 } >
326
322
{ portals }
327
323
</ div >
328
324
) ;
Original file line number Diff line number Diff line change @@ -126,11 +126,7 @@ export const GridviewReact = React.forwardRef(
126
126
} , [ props . components ] ) ;
127
127
128
128
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 } >
134
130
{ portals }
135
131
</ div >
136
132
) ;
Original file line number Diff line number Diff line change @@ -176,11 +176,7 @@ export const PaneviewReact = React.forwardRef(
176
176
} , [ props . onDidDrop ] ) ;
177
177
178
178
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 } >
184
180
{ portals }
185
181
</ div >
186
182
) ;
Original file line number Diff line number Diff line change @@ -126,11 +126,7 @@ export const SplitviewReact = React.forwardRef(
126
126
} , [ props . components ] ) ;
127
127
128
128
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 } >
134
130
{ portals }
135
131
</ div >
136
132
) ;
You can’t perform that action at this time.
0 commit comments