Merge pull request #144 from mathuo/143-fix-panel-getparams

fix: change get(params)
This commit is contained in:
mathuo 2022-07-15 19:28:46 +01:00 committed by GitHub
commit e2f981274c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 43 additions and 1 deletions

View File

@ -112,4 +112,26 @@ describe('dockviewGroupPanel', () => {
expect(view.dispose).toHaveBeenCalled();
});
test('get params', () => {
const dockviewApiMock = jest.fn<DockviewApi, []>(() => {
return {} as any;
});
const accessorMock = jest.fn<DockviewComponent, []>(() => {
return {} as any;
});
const groupMock = jest.fn<GroupPanel, []>(() => {
return {} as any;
});
const api = new dockviewApiMock();
const accessor = new accessorMock();
const group = new groupMock();
const cut = new DockviewGroupPanel('fake-id', accessor, api, group);
expect(cut.params).toEqual(undefined);
cut.update({ params: { params: { variableA: 'A', variableB: 'B' } } });
expect(cut.params).toEqual({ variableA: 'A', variableB: 'B' });
});
});

View File

@ -0,0 +1,20 @@
import { DockviewComponent } from '../../dockview/dockviewComponent';
import { GroupPanel } from '../../groupview/groupviewPanel';
describe('gridviewPanel', () => {
test('get panel', () => {
const accessorMock = jest.fn<DockviewComponent, []>(() => {
return {} as any;
});
const accessor = new accessorMock();
const cut = new GroupPanel(accessor, 'id', {});
expect(cut.params).toEqual(undefined);
cut.update({ params: { variableA: 'A', variableB: 'B' } });
expect(cut.params).toEqual({ variableA: 'A', variableB: 'B' });
});
});

View File

@ -28,7 +28,7 @@ export class DockviewGroupPanel
private _suppressClosable: boolean;
get params() {
return this._params?.params;
return this._params;
}
get title() {