Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 12 additions & 11 deletions packages/dockview/src/__tests__/api/groupPanelApi.spec.ts
Original file line number Diff line number Diff line change
@@ -1,24 +1,25 @@
import { IDockviewComponent, IGroupPanel } from '../..';
import { IDockviewComponent } from '../../dockview/dockviewComponent';
import { DockviewPanelApiImpl, TitleEvent } from '../../api/groupPanelApi';
import { GroupviewPanel } from '../../groupview/groupviewPanel';
import { IDockviewPanel } from '../../groupview/groupPanel';
import { GroupPanel } from '../../groupview/groupviewPanel';

describe('groupPanelApi', () => {
test('title', () => {
const groupPanel: Partial<IGroupPanel> = {
const groupPanel: Partial<IDockviewPanel> = {
id: 'test_id',
title: 'test_title',
};

const accessor: Partial<IDockviewComponent> = {};
const groupViewPanel = new GroupviewPanel(
const groupViewPanel = new GroupPanel(
<IDockviewComponent>accessor,
'',
{}
);

const cut = new DockviewPanelApiImpl(
<IGroupPanel>groupPanel,
<GroupviewPanel>groupViewPanel
<IDockviewPanel>groupPanel,
<GroupPanel>groupViewPanel
);

let events: TitleEvent[] = [];
Expand All @@ -39,20 +40,20 @@ describe('groupPanelApi', () => {
});

test('onDidGroupChange', () => {
const groupPanel: Partial<IGroupPanel> = {
const groupPanel: Partial<IDockviewPanel> = {
id: 'test_id',
};

const accessor: Partial<IDockviewComponent> = {};
const groupViewPanel = new GroupviewPanel(
const groupViewPanel = new GroupPanel(
<IDockviewComponent>accessor,
'',
{}
);

const cut = new DockviewPanelApiImpl(
<IGroupPanel>groupPanel,
<GroupviewPanel>groupViewPanel
<IDockviewPanel>groupPanel,
<GroupPanel>groupViewPanel
);

let events = 0;
Expand All @@ -64,7 +65,7 @@ describe('groupPanelApi', () => {
expect(events).toBe(0);
expect(cut.group).toBe(groupViewPanel);

const groupViewPanel2 = new GroupviewPanel(
const groupViewPanel2 = new GroupPanel(
<IDockviewComponent>accessor,
'',
{}
Expand Down
8 changes: 4 additions & 4 deletions packages/dockview/src/__tests__/dockview/deserializer.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import {
} from '../../dockview/deserializer';
import { DockviewComponent } from '../../dockview/dockviewComponent';
import { Groupview } from '../../groupview/groupview';
import { GroupviewPanel } from '../../groupview/groupviewPanel';
import { GroupPanel } from '../../groupview/groupviewPanel';

describe('deserializer', () => {
test('fromJSON', () => {
Expand All @@ -21,14 +21,14 @@ describe('deserializer', () => {
const panel1 = jest.fn();
const panel2 = jest.fn();

const groupMock = jest.fn<GroupviewPanel, []>(() => {
const result: Partial<GroupviewPanel> = {
const groupMock = jest.fn<GroupPanel, []>(() => {
const result: Partial<GroupPanel> = {
model: new model(),
panels: <any>[panel1, panel2],
activePanel: null,
};

return result as GroupviewPanel;
return result as GroupPanel;
});
const group = new groupMock();
const createGroup = jest.fn().mockReturnValue(new groupMock());
Expand Down
30 changes: 15 additions & 15 deletions packages/dockview/src/__tests__/dockview/dockviewComponent.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@ import { PanelUpdateEvent } from '../../panel/types';
import { Orientation } from '../../splitview/core/splitview';
import { ReactPanelDeserialzier } from '../../react/deserializer';
import { Position } from '../../dnd/droptarget';
import { GroupviewPanel } from '../../groupview/groupviewPanel';
import { GroupPanel } from '../../groupview/groupviewPanel';
import { CompositeDisposable } from '../../lifecycle';
import {
GroupPanelUpdateEvent,
GroupviewPanelState,
IGroupPanel,
IDockviewPanel,
IGroupPanelInitParameters,
} from '../../groupview/groupPanel';
import { IGroupPanelView } from '../../dockview/defaultGroupPanelView';
Expand All @@ -39,7 +39,7 @@ class PanelContentPartTest implements IContentRenderer {
this.element.classList.add(`testpanel-${id}`);
}

updateParentGroup(group: GroupviewPanel, isPanelVisible: boolean): void {
updateParentGroup(group: GroupPanel, isPanelVisible: boolean): void {
//noop
}

Expand Down Expand Up @@ -81,7 +81,7 @@ class PanelTabPartTest implements ITabRenderer {
this.element.classList.add(`testpanel-${id}`);
}

updateParentGroup(group: GroupviewPanel, isPanelVisible: boolean): void {
updateParentGroup(group: GroupPanel, isPanelVisible: boolean): void {
//noop
}

Expand Down Expand Up @@ -130,7 +130,7 @@ class TestGroupPanelView implements IGroupPanelView {
//
}

updateParentGroup(group: GroupviewPanel, isPanelVisible: boolean): void {
updateParentGroup(group: GroupPanel, isPanelVisible: boolean): void {
//
}

Expand All @@ -143,8 +143,8 @@ class TestGroupPanelView implements IGroupPanelView {
}
}

class TestGroupPanel implements IGroupPanel {
private _group: GroupviewPanel | undefined;
class TestGroupPanel implements IDockviewPanel {
private _group: GroupPanel | undefined;

readonly view: IGroupPanelView;
readonly suppressClosable: boolean = false;
Expand All @@ -156,7 +156,7 @@ class TestGroupPanel implements IGroupPanel {
accessor: IDockviewComponent
) {
this.api = new DockviewPanelApiImpl(this, this._group);
this._group = new GroupviewPanel(accessor, id, {});
this._group = new GroupPanel(accessor, id, {});
this.view = new TestGroupPanelView(
new PanelContentPartTest(id, 'component')
);
Expand All @@ -166,11 +166,11 @@ class TestGroupPanel implements IGroupPanel {
return {};
}

get group(): GroupviewPanel | undefined {
get group(): GroupPanel | undefined {
return this._group;
}

updateParentGroup(group: GroupviewPanel, isGroupActive: boolean): void {
updateParentGroup(group: GroupPanel, isGroupActive: boolean): void {
this._group = group;
}

Expand Down Expand Up @@ -876,8 +876,8 @@ describe('dockviewComponent', () => {
dockview.layout(1000, 1000);

let events: {
panel?: IGroupPanel;
group?: GroupviewPanel | undefined;
panel?: IDockviewPanel;
group?: GroupPanel | undefined;
type: string;
}[] = [];

Expand Down Expand Up @@ -1042,7 +1042,7 @@ describe('dockviewComponent', () => {
test('#1', () => {
dockview.layout(500, 500);
dockview.deserializer = {
fromJSON: (panelData: GroupviewPanelState): IGroupPanel => {
fromJSON: (panelData: GroupviewPanelState): IDockviewPanel => {
return new TestGroupPanel(
panelData.id,
panelData.title,
Expand All @@ -1067,8 +1067,8 @@ describe('dockviewComponent', () => {
position: { referencePanel: 'panel2', direction: 'below' },
});

const removedGroups: GroupviewPanel[] = [];
const removedPanels: IGroupPanel[] = [];
const removedGroups: GroupPanel[] = [];
const removedPanels: IDockviewPanel[] = [];

const disposable = new CompositeDisposable(
dockview.onDidRemoveGroup((group) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { DockviewComponent } from '../../dockview/dockviewComponent';
import { DockviewApi } from '../../api/component.api';
import { IGroupPanelView } from '../../dockview/defaultGroupPanelView';
import { DockviewGroupPanel } from '../../dockview/dockviewGroupPanel';
import { GroupviewPanel } from '../../groupview/groupviewPanel';
import { GroupPanel } from '../../groupview/groupviewPanel';

describe('dockviewGroupPanel', () => {
test('update title', () => {
Expand All @@ -14,7 +14,7 @@ describe('dockviewGroupPanel', () => {
const accessorMock = jest.fn<DockviewComponent, []>(() => {
return {} as any;
});
const groupMock = jest.fn<GroupviewPanel, []>(() => {
const groupMock = jest.fn<GroupPanel, []>(() => {
return {} as any;
});
const api = new dockviewApiMock();
Expand Down Expand Up @@ -48,7 +48,7 @@ describe('dockviewGroupPanel', () => {
const accessorMock = jest.fn<DockviewComponent, []>(() => {
return {} as any;
});
const groupMock = jest.fn<GroupviewPanel, []>(() => {
const groupMock = jest.fn<GroupPanel, []>(() => {
return {} as any;
});
const api = new dockviewApiMock();
Expand Down Expand Up @@ -88,7 +88,7 @@ describe('dockviewGroupPanel', () => {
const accessorMock = jest.fn<DockviewComponent, []>(() => {
return {} as any;
});
const groupMock = jest.fn<GroupviewPanel, []>(() => {
const groupMock = jest.fn<GroupPanel, []>(() => {
return {} as any;
});
const api = new dockviewApiMock();
Expand Down
22 changes: 11 additions & 11 deletions packages/dockview/src/__tests__/groupview/groupview.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import {
} from '../../dockview/dockviewComponent';
import {
GroupviewPanelState,
IGroupPanel,
IDockviewPanel,
IGroupPanelInitParameters,
} from '../../groupview/groupPanel';
import {
Expand All @@ -14,7 +14,6 @@ import {
IWatermarkRenderer,
} from '../../groupview/types';
import { PanelUpdateEvent } from '../../panel/types';
import { GroupviewPanel } from '../../groupview/groupviewPanel';
import {
GroupChangeKind2,
GroupOptions,
Expand All @@ -25,6 +24,7 @@ import {
DefaultGroupPanelView,
IGroupPanelView,
} from '../../dockview/defaultGroupPanelView';
import { GroupPanel } from '../../groupview/groupviewPanel';

class Watermark implements IWatermarkRenderer {
public readonly element = document.createElement('div');
Expand Down Expand Up @@ -81,7 +81,7 @@ class TestContentPart implements IContentRenderer {
//void
}

updateParentGroup(group: GroupviewPanel, isPanelVisible: boolean) {
updateParentGroup(group: GroupPanel, isPanelVisible: boolean) {
//noop
}

Expand Down Expand Up @@ -116,7 +116,7 @@ class TestHeaderPart implements ITabRenderer {
//void
}

updateParentGroup(group: GroupviewPanel, isPanelVisible: boolean) {
updateParentGroup(group: GroupPanel, isPanelVisible: boolean) {
//noop
}

Expand All @@ -133,9 +133,9 @@ class TestHeaderPart implements ITabRenderer {
}
}

class TestPanel implements IGroupPanel {
class TestPanel implements IDockviewPanel {
private _view: IGroupPanelView | undefined;
private _group: GroupviewPanel | undefined;
private _group: GroupPanel | undefined;
private _params: IGroupPanelInitParameters;

get title() {
Expand Down Expand Up @@ -175,7 +175,7 @@ class TestPanel implements IGroupPanel {
this._params = params;
}

updateParentGroup(group: GroupviewPanel, isGroupActive: boolean) {
updateParentGroup(group: GroupPanel, isGroupActive: boolean) {
this._group = group;
}

Expand Down Expand Up @@ -205,7 +205,7 @@ class TestPanel implements IGroupPanel {
}

describe('groupview', () => {
let groupview: GroupviewPanel;
let groupview: GroupPanel;
let dockview: IDockviewComponent;
let options: GroupOptions;

Expand All @@ -228,7 +228,7 @@ describe('groupview', () => {
options = {
tabHeight: 30,
};
groupview = new GroupviewPanel(dockview, 'groupview-1', options);
groupview = new GroupPanel(dockview, 'groupview-1', options);
groupview.initialize();
});

Expand All @@ -237,7 +237,7 @@ describe('groupview', () => {
const panel2 = new TestPanel('panel2', jest.fn() as any);
const panel3 = new TestPanel('panel3', jest.fn() as any);

const groupview2 = new GroupviewPanel(dockview, 'groupview-2', {
const groupview2 = new GroupPanel(dockview, 'groupview-2', {
tabHeight: 25,
panels: [panel1, panel2, panel3],
activePanel: panel2,
Expand All @@ -262,7 +262,7 @@ describe('groupview', () => {
const panel2 = new TestPanel('panel2', jest.fn() as any);
const panel3 = new TestPanel('panel3', jest.fn() as any);

const groupview2 = new GroupviewPanel(dockview, 'groupview-2', {
const groupview2 = new GroupPanel(dockview, 'groupview-2', {
tabHeight: 25,
panels: [panel1, panel2, panel3],
activePanel: panel2,
Expand Down
17 changes: 9 additions & 8 deletions packages/dockview/src/__tests__/groupview/panel/content.spec.ts
Original file line number Diff line number Diff line change
@@ -1,19 +1,20 @@
import { fireEvent } from '@testing-library/dom';
import { Emitter, Event } from '../../../events';
import { IGroupPanel } from '../../../groupview/groupPanel';
import { ContentContainer } from '../../../groupview/panel/content';
import {
GroupPanelContentPartInitParameters,
IContentRenderer,
} from '../../../groupview/types';
import { GroupviewPanel } from '../../../groupview/groupviewPanel';
import { CompositeDisposable } from '../../../lifecycle';
import { PanelUpdateEvent } from '../../../panel/types';
import { IGroupPanelView } from '../../../dockview/defaultGroupPanelView';
import { IDockviewPanel } from '../../../groupview/groupPanel';
import { GroupPanel } from '../../../groupview/groupviewPanel';

class TestContentRenderer
extends CompositeDisposable
implements IContentRenderer {
implements IContentRenderer
{
readonly element: HTMLElement;

readonly _onDidFocus = new Emitter<void>();
Expand All @@ -26,7 +27,7 @@ class TestContentRenderer
this.element = document.createElement('div');
}

updateParentGroup(group: GroupviewPanel, isPanelVisible: boolean): void {
updateParentGroup(group: GroupPanel, isPanelVisible: boolean): void {
//
}

Expand Down Expand Up @@ -77,9 +78,9 @@ describe('contentContainer', () => {
view: {
content: contentRenderer,
} as Partial<IGroupPanelView>,
} as Partial<IGroupPanel>;
} as Partial<IDockviewPanel>;

cut.openPanel(panel as IGroupPanel);
cut.openPanel(panel as IDockviewPanel);

expect(focus).toBe(0);
expect(blur).toBe(0);
Expand Down Expand Up @@ -111,9 +112,9 @@ describe('contentContainer', () => {
view: {
content: contentRenderer2,
} as Partial<IGroupPanelView>,
} as Partial<IGroupPanel>;
} as Partial<IDockviewPanel>;

cut.openPanel(panel2 as IGroupPanel);
cut.openPanel(panel2 as IDockviewPanel);
expect(focus).toBe(2);
expect(blur).toBe(2);

Expand Down
Loading