mirror of
https://github.com/mathuo/dockview
synced 2025-05-01 17:18:27 +00:00
Merge branch 'master' of https://github.com/mathuo/dockview into 176-dnd-to-edge-of-dockview
This commit is contained in:
commit
c99a385a1d
@ -31,6 +31,10 @@ enum GroupChangeKind2 {
|
||||
class Watermark implements IWatermarkRenderer {
|
||||
public readonly element = document.createElement('div');
|
||||
|
||||
constructor() {
|
||||
this.element.className = `watermark-test-container`;
|
||||
}
|
||||
|
||||
get id() {
|
||||
return 'watermark-id';
|
||||
}
|
||||
@ -855,4 +859,71 @@ describe('groupview', () => {
|
||||
element.getElementsByClassName('drop-target-dropzone').length
|
||||
).toBe(0);
|
||||
});
|
||||
|
||||
test('that watermark is added', () => {
|
||||
const groupviewMock = jest.fn<Partial<Groupview>, []>(() => {
|
||||
return {
|
||||
canDisplayOverlay: jest.fn(),
|
||||
};
|
||||
});
|
||||
|
||||
const groupView = new groupviewMock() as Groupview;
|
||||
|
||||
const groupPanelMock = jest.fn<Partial<GroupPanel>, []>(() => {
|
||||
return {
|
||||
id: 'testgroupid',
|
||||
model: groupView,
|
||||
};
|
||||
});
|
||||
|
||||
const container = document.createElement('div');
|
||||
|
||||
const cut = new Groupview(
|
||||
container,
|
||||
dockview,
|
||||
'groupviewid',
|
||||
{},
|
||||
new groupPanelMock() as GroupPanel
|
||||
);
|
||||
|
||||
cut.initialize();
|
||||
|
||||
expect(
|
||||
container.getElementsByClassName('watermark-test-container').length
|
||||
).toBe(1);
|
||||
|
||||
cut.openPanel(new TestPanel('panel1', jest.fn() as any));
|
||||
|
||||
expect(
|
||||
container.getElementsByClassName('watermark-test-container').length
|
||||
).toBe(0);
|
||||
expect(
|
||||
container.getElementsByClassName('tabs-and-actions-container')
|
||||
.length
|
||||
).toBe(1);
|
||||
|
||||
cut.openPanel(new TestPanel('panel2', jest.fn() as any));
|
||||
|
||||
expect(
|
||||
container.getElementsByClassName('watermark-test-container').length
|
||||
).toBe(0);
|
||||
|
||||
cut.removePanel('panel1');
|
||||
|
||||
expect(
|
||||
container.getElementsByClassName('watermark-test-container').length
|
||||
).toBe(0);
|
||||
|
||||
cut.removePanel('panel2');
|
||||
|
||||
expect(
|
||||
container.getElementsByClassName('watermark-test-container').length
|
||||
).toBe(1);
|
||||
|
||||
cut.openPanel(new TestPanel('panel1', jest.fn() as any));
|
||||
|
||||
expect(
|
||||
container.getElementsByClassName('watermark-test-container').length
|
||||
).toBe(0);
|
||||
});
|
||||
});
|
||||
|
@ -667,9 +667,8 @@ export class Groupview extends CompositeDisposable implements IGroupview {
|
||||
}
|
||||
});
|
||||
|
||||
this.contentContainer.hide();
|
||||
this.tabsContainer.hide();
|
||||
this.container.appendChild(this.watermark.element);
|
||||
this.contentContainer.element.appendChild(this.watermark.element);
|
||||
|
||||
this.watermark.updateParentGroup(this.groupPanel, true);
|
||||
}
|
||||
@ -677,7 +676,6 @@ export class Groupview extends CompositeDisposable implements IGroupview {
|
||||
this.watermark.element.remove();
|
||||
this.watermark.dispose();
|
||||
this.watermark = undefined;
|
||||
this.contentContainer.show();
|
||||
this.tabsContainer.show();
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user