bug: remove splitview dom element

This commit is contained in:
mathuo 2025-03-14 22:12:22 +00:00
parent 54ae457ccd
commit d30263af67
No known key found for this signature in database
GPG Key ID: C6EEDEFD6CA07281
4 changed files with 21 additions and 0 deletions

View File

@ -198,6 +198,8 @@ describe('gridview', () => {
}, },
}); });
expect(container.querySelectorAll('.dv-grid-view').length).toBe(1);
gridview.layout(800, 400); gridview.layout(800, 400);
gridview.fromJSON({ gridview.fromJSON({
grid: { grid: {
@ -242,6 +244,9 @@ describe('gridview', () => {
}, },
activePanel: 'panel_1', activePanel: 'panel_1',
}); });
expect(container.querySelectorAll('.dv-grid-view').length).toBe(1);
gridview.layout(800, 400, true); gridview.layout(800, 400, true);
const panel1 = gridview.getPanel('panel_1')!; const panel1 = gridview.getPanel('panel_1')!;

View File

@ -180,6 +180,8 @@ describe('componentPaneview', () => {
}, },
}); });
expect(container.querySelectorAll('.dv-pane-container').length).toBe(1);
paneview.fromJSON({ paneview.fromJSON({
size: 6, size: 6,
views: [ views: [
@ -212,6 +214,8 @@ describe('componentPaneview', () => {
], ],
}); });
expect(container.querySelectorAll('.dv-pane-container').length).toBe(1);
paneview.layout(400, 800); paneview.layout(400, 800);
const panel1 = paneview.getPanel('panel1'); const panel1 = paneview.getPanel('panel1');

View File

@ -395,6 +395,10 @@ describe('componentSplitview', () => {
}); });
splitview.layout(400, 6); splitview.layout(400, 6);
expect(
container.querySelectorAll('.dv-split-view-container').length
).toBe(1);
splitview.fromJSON({ splitview.fromJSON({
views: [ views: [
{ {
@ -414,6 +418,10 @@ describe('componentSplitview', () => {
activeView: 'panel1', activeView: 'panel1',
}); });
expect(
container.querySelectorAll('.dv-split-view-container').length
).toBe(1);
expect(splitview.length).toBe(3); expect(splitview.length).toBe(3);
expect(JSON.parse(JSON.stringify(splitview.toJSON()))).toEqual({ expect(JSON.parse(JSON.stringify(splitview.toJSON()))).toEqual({

View File

@ -122,6 +122,10 @@ export class SplitviewComponent
} }
set splitview(value: Splitview) { set splitview(value: Splitview) {
if (this._splitview) {
this._splitview.dispose();
}
this._splitview = value; this._splitview = value;
this._splitviewChangeDisposable.value = new CompositeDisposable( this._splitviewChangeDisposable.value = new CompositeDisposable(