Skip to content

Commit

Permalink
bug: popout group to new group rendering bug fix
Browse files Browse the repository at this point in the history
  • Loading branch information
mathuo committed Dec 22, 2024
1 parent 6016362 commit 81a904c
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4872,7 +4872,7 @@ describe('dockviewComponent', () => {
);
});

test('basic', async () => {
test('deserailize popout with no reference group', async () => {
jest.useRealTimers();

const container = document.createElement('div');
Expand Down Expand Up @@ -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');

Expand Down
4 changes: 1 addition & 3 deletions packages/dockview-core/src/dockview/dockviewComponent.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down

0 comments on commit 81a904c

Please sign in to comment.