mirror of
				https://github.com/mathuo/dockview
				synced 2025-11-03 21:57:17 +00:00 
			
		
		
		
	Merge pull request #144 from mathuo/143-fix-panel-getparams
fix: change get(params)
This commit is contained in:
		
						commit
						e2f981274c
					
				@ -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' });
 | 
			
		||||
    });
 | 
			
		||||
});
 | 
			
		||||
 | 
			
		||||
@ -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' });
 | 
			
		||||
    });
 | 
			
		||||
});
 | 
			
		||||
@ -28,7 +28,7 @@ export class DockviewGroupPanel
 | 
			
		||||
    private _suppressClosable: boolean;
 | 
			
		||||
 | 
			
		||||
    get params() {
 | 
			
		||||
        return this._params?.params;
 | 
			
		||||
        return this._params;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    get title() {
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user