bug: remove element after dispose

This commit is contained in:
mathuo 2025-03-10 21:35:17 +00:00
parent 090f2d26f8
commit 4eff83e9a0
No known key found for this signature in database
GPG Key ID: C6EEDEFD6CA07281
5 changed files with 36 additions and 30 deletions

View File

@ -58,7 +58,7 @@ describe('gridview', () => {
const gridview = new GridviewComponent(container, {
proportionalLayout: false,
orientation: Orientation.VERTICAL,
createComponent: (options) => {
createComponent: (options) => {
switch (options.name) {
case 'default':
return new TestGridview(options.id, options.name);
@ -84,7 +84,7 @@ describe('gridview', () => {
const gridview = new GridviewComponent(container, {
proportionalLayout: false,
orientation: Orientation.VERTICAL,
createComponent: (options) => {
createComponent: (options) => {
switch (options.name) {
case 'default':
return new TestGridview(options.id, options.name);
@ -121,7 +121,7 @@ describe('gridview', () => {
const gridview = new GridviewComponent(container, {
proportionalLayout: false,
orientation: Orientation.VERTICAL,
createComponent: (options) => {
createComponent: (options) => {
switch (options.name) {
case 'default':
return new TestGridview(options.id, options.name);
@ -188,7 +188,7 @@ describe('gridview', () => {
const gridview = new GridviewComponent(container, {
proportionalLayout: false,
orientation: Orientation.VERTICAL,
createComponent: (options) => {
createComponent: (options) => {
switch (options.name) {
case 'default':
return new TestGridview(options.id, options.name);
@ -322,7 +322,7 @@ describe('gridview', () => {
const gridview = new GridviewComponent(container, {
proportionalLayout: false,
orientation: Orientation.VERTICAL,
createComponent: (options) => {
createComponent: (options) => {
switch (options.name) {
case 'default':
return new TestGridview(options.id, options.name);
@ -365,7 +365,7 @@ describe('gridview', () => {
const gridview = new GridviewComponent(container, {
proportionalLayout: false,
orientation: Orientation.VERTICAL,
createComponent: (options) => {
createComponent: (options) => {
switch (options.name) {
case 'default':
return new TestGridview(options.id, options.name);
@ -495,7 +495,7 @@ describe('gridview', () => {
const gridview = new GridviewComponent(container, {
proportionalLayout: false,
orientation: Orientation.VERTICAL,
createComponent: (options) => {
createComponent: (options) => {
switch (options.name) {
case 'default':
return new TestGridview(options.id, options.name);
@ -524,14 +524,14 @@ describe('gridview', () => {
gridview.dispose();
expect(container.childNodes.length).toBe(0);
expect(container.children.length).toBe(0);
});
test('#1/VERTICAL', () => {
const gridview = new GridviewComponent(container, {
proportionalLayout: true,
orientation: Orientation.VERTICAL,
createComponent: (options) => {
createComponent: (options) => {
switch (options.name) {
case 'default':
return new TestGridview(options.id, options.name);
@ -596,7 +596,7 @@ describe('gridview', () => {
const gridview = new GridviewComponent(container, {
proportionalLayout: true,
orientation: Orientation.HORIZONTAL,
createComponent: (options) => {
createComponent: (options) => {
switch (options.name) {
case 'default':
return new TestGridview(options.id, options.name);
@ -661,7 +661,7 @@ describe('gridview', () => {
const gridview = new GridviewComponent(container, {
proportionalLayout: true,
orientation: Orientation.HORIZONTAL,
createComponent: (options) => {
createComponent: (options) => {
switch (options.name) {
case 'default':
return new TestGridview(options.id, options.name);
@ -744,7 +744,7 @@ describe('gridview', () => {
const gridview = new GridviewComponent(container, {
proportionalLayout: true,
orientation: Orientation.HORIZONTAL,
createComponent: (options) => {
createComponent: (options) => {
switch (options.name) {
case 'default':
return new TestGridview(options.id, options.name);
@ -845,7 +845,7 @@ describe('gridview', () => {
const gridview = new GridviewComponent(container, {
proportionalLayout: true,
orientation: Orientation.VERTICAL,
createComponent: (options) => {
createComponent: (options) => {
switch (options.name) {
case 'default':
return new TestGridview(options.id, options.name);
@ -946,7 +946,7 @@ describe('gridview', () => {
const gridview = new GridviewComponent(container, {
proportionalLayout: false,
orientation: Orientation.VERTICAL,
createComponent: (options) => {
createComponent: (options) => {
switch (options.name) {
case 'default':
return new TestGridview(options.id, options.name);
@ -1047,7 +1047,7 @@ describe('gridview', () => {
const gridview = new GridviewComponent(container, {
proportionalLayout: true,
orientation: Orientation.VERTICAL,
createComponent: (options) => {
createComponent: (options) => {
switch (options.name) {
case 'default':
return new TestGridview(options.id, options.name);
@ -1178,7 +1178,7 @@ describe('gridview', () => {
const gridview = new GridviewComponent(container, {
proportionalLayout: true,
orientation: Orientation.VERTICAL,
createComponent: (options) => {
createComponent: (options) => {
switch (options.name) {
case 'default':
return new TestGridview(options.id, options.name);
@ -1309,7 +1309,7 @@ describe('gridview', () => {
const gridview = new GridviewComponent(container, {
proportionalLayout: true,
orientation: Orientation.VERTICAL,
createComponent: (options) => {
createComponent: (options) => {
switch (options.name) {
case 'default':
return new TestGridview(options.id, options.name);
@ -1442,7 +1442,7 @@ describe('gridview', () => {
const gridview = new GridviewComponent(container, {
proportionalLayout: true,
orientation: Orientation.HORIZONTAL,
createComponent: (options) => {
createComponent: (options) => {
switch (options.name) {
case 'default':
return new TestGridview(options.id, options.name);
@ -1573,7 +1573,7 @@ describe('gridview', () => {
const gridview = new GridviewComponent(container, {
proportionalLayout: false,
orientation: Orientation.HORIZONTAL,
createComponent: (options) => {
createComponent: (options) => {
switch (options.name) {
case 'default':
return new TestGridview(options.id, options.name);
@ -1704,7 +1704,7 @@ describe('gridview', () => {
const gridview = new GridviewComponent(container, {
proportionalLayout: true,
orientation: Orientation.HORIZONTAL,
createComponent: (options) => {
createComponent: (options) => {
switch (options.name) {
case 'default':
return new TestGridview(options.id, options.name);
@ -1838,7 +1838,7 @@ describe('gridview', () => {
const gridview = new GridviewComponent(container, {
proportionalLayout: false,
orientation: Orientation.VERTICAL,
createComponent: (options) => {
createComponent: (options) => {
switch (options.name) {
case 'default':
return new TestGridview(options.id, options.name);
@ -1875,7 +1875,7 @@ describe('gridview', () => {
const gridview = new GridviewComponent(container, {
proportionalLayout: false,
orientation: Orientation.VERTICAL,
createComponent: (options) => {
createComponent: (options) => {
switch (options.name) {
case 'default':
return new TestGridview(options.id, options.name);
@ -1911,7 +1911,7 @@ describe('gridview', () => {
const gridview = new GridviewComponent(container, {
proportionalLayout: false,
orientation: Orientation.VERTICAL,
createComponent: (options) => {
createComponent: (options) => {
switch (options.name) {
case 'default':
return new TestGridview(options.id, options.name);
@ -1956,7 +1956,7 @@ describe('gridview', () => {
const gridview = new GridviewComponent(container, {
proportionalLayout: true,
orientation: Orientation.HORIZONTAL,
createComponent: (options) => {
createComponent: (options) => {
switch (options.name) {
case 'default':
return new TestGridview(options.id, options.name);
@ -2085,7 +2085,7 @@ describe('gridview', () => {
const gridview = new GridviewComponent(container, {
proportionalLayout: true,
orientation: Orientation.VERTICAL,
createComponent: (options) => {
createComponent: (options) => {
switch (options.name) {
case 'default':
return new TestGridview(options.id, options.name);
@ -2218,7 +2218,7 @@ describe('gridview', () => {
const gridview = new GridviewComponent(container, {
proportionalLayout: true,
orientation: Orientation.VERTICAL,
createComponent: (options) => {
createComponent: (options) => {
switch (options.name) {
case 'default':
return new TestGridview(options.id, options.name);
@ -2500,7 +2500,7 @@ describe('gridview', () => {
const gridview = new GridviewComponent(container, {
proportionalLayout: true,
orientation: Orientation.VERTICAL,
createComponent: (options) => {
createComponent: (options) => {
switch (options.name) {
case 'default':
return new TestGridview(options.id, options.name);
@ -2864,7 +2864,7 @@ describe('gridview', () => {
const gridview = new GridviewComponent(container, {
proportionalLayout: true,
orientation: Orientation.HORIZONTAL,
createComponent: (options) => {
createComponent: (options) => {
switch (options.name) {
case 'default':
return new TestGridview(options.id, options.name);
@ -2881,7 +2881,7 @@ describe('gridview', () => {
const gridview = new GridviewComponent(container, {
proportionalLayout: true,
orientation: Orientation.HORIZONTAL,
createComponent: (options) => {
createComponent: (options) => {
switch (options.name) {
case 'default':
return new TestGridview(options.id, options.name);
@ -2899,7 +2899,7 @@ describe('gridview', () => {
const gridview = new GridviewComponent(container, {
proportionalLayout: true,
orientation: Orientation.HORIZONTAL,
createComponent: (options) => {
createComponent: (options) => {
switch (options.name) {
case 'default':
return new TestGridview(options.id, options.name);

View File

@ -86,6 +86,7 @@ describe('componentPaneview', () => {
paneview.dispose();
expect(container.parentElement).toBe(root);
expect(container.children.length).toBe(0);
});
test('vertical panels', () => {

View File

@ -46,6 +46,7 @@ describe('componentSplitview', () => {
splitview.dispose();
expect(container.parentElement).toBe(root);
expect(container.children.length).toBe(0);
});
test('event leakage', () => {

View File

@ -476,6 +476,8 @@ export class PaneviewComponent extends Resizable implements IPaneviewComponent {
}
this._viewDisposables.clear();
this.element.remove();
this.paneview.dispose();
}
}

View File

@ -425,6 +425,8 @@ export class SplitviewComponent
view.dispose();
}
this.element.remove();
super.dispose();
}
}