Merge pull request #800 from mathuo/799-popout-group-new-group-rendering-bug

bug: popout group to new group rendering bug fix
This commit is contained in:
mathuo 2024-12-22 10:17:18 +00:00 committed by GitHub
commit e45d9e48e8
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 45 additions and 4 deletions

View File

@ -4872,7 +4872,7 @@ describe('dockviewComponent', () => {
);
});
test('basic', async () => {
test('deserailize popout with no reference group', async () => {
jest.useRealTimers();
const container = document.createElement('div');
@ -5021,6 +5021,49 @@ describe('dockviewComponent', () => {
expect(panel3.api.location.type).toBe('grid');
});
test('that panel is rendered when moving from popout to new group', async () => {
const container = document.createElement('div');
window.open = () => setupMockWindow();
const dockview = new DockviewComponent(container, {
createComponent(options) {
switch (options.name) {
case 'default':
return new PanelContentPartTest(
options.id,
options.name
);
default:
throw new Error(`unsupported`);
}
},
});
dockview.layout(1000, 500);
const panel1 = dockview.addPanel({
id: 'panel_1',
component: 'default',
});
const panel2 = dockview.addPanel({
id: 'panel_2',
component: 'default',
});
await dockview.addPopoutGroup(panel2);
panel2.api.moveTo({ group: panel1.api.group, position: 'right' });
// confirm panel is rendered on DOM
expect(
panel2.group.element.querySelectorAll(
'.dv-content-container > .testpanel-panel_2'
).length
).toBe(1);
});
test('move popout group of 1 panel inside grid', async () => {
const container = document.createElement('div');

View File

@ -2114,9 +2114,7 @@ export class DockviewComponent
const newGroup = this.createGroupAtLocation(targetLocation);
this.movingLock(() =>
newGroup.model.openPanel(removedPanel, {
skipSetActive: true,
})
newGroup.model.openPanel(removedPanel)
);
this.doSetGroupAndPanelActive(newGroup);