mirror of
https://github.com/mathuo/dockview
synced 2025-02-13 20:05:46 +00:00
Merge pull request #31 from mathuo/23-increase-test-coverage
chore: reduce sonar smells
This commit is contained in:
commit
2e7711486b
@ -221,11 +221,6 @@ export class DockviewComponent
|
||||
typeof options.orientation === 'string' &&
|
||||
this.options.orientation !== options.orientation;
|
||||
|
||||
// TODO support style update
|
||||
// const hasStylesChanged =
|
||||
// typeof options.styles === 'object' &&
|
||||
// this.options.styles !== options.styles;
|
||||
|
||||
this._options = { ...this.options, ...options };
|
||||
|
||||
if (hasOrientationChanged) {
|
||||
@ -409,16 +404,14 @@ export class DockviewComponent
|
||||
}
|
||||
|
||||
fireMouseEvent(event: LayoutMouseEvent): void {
|
||||
switch (event.kind) {
|
||||
case MouseEventKind.CONTEXT_MENU:
|
||||
if (event.tab && event.panel) {
|
||||
this._onTabContextMenu.fire({
|
||||
event: event.event,
|
||||
api: this._api,
|
||||
panel: event.panel,
|
||||
});
|
||||
}
|
||||
break;
|
||||
if (event.kind === MouseEventKind.CONTEXT_MENU) {
|
||||
if (event.tab && event.panel) {
|
||||
this._onTabContextMenu.fire({
|
||||
event: event.event,
|
||||
api: this._api,
|
||||
panel: event.panel,
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -42,8 +42,6 @@ export class Emitter<T> implements IDisposable {
|
||||
listener(this._last);
|
||||
}
|
||||
|
||||
const firstListener = this._listeners.length === 0;
|
||||
|
||||
this._listeners.push(listener);
|
||||
|
||||
return {
|
||||
|
@ -618,9 +618,10 @@ export class Gridview implements IDisposable {
|
||||
return node.view;
|
||||
}
|
||||
|
||||
const sibling = parent.children[0];
|
||||
|
||||
if (pathToParent.length === 0) {
|
||||
// parent is root
|
||||
const sibling = parent.children[0];
|
||||
|
||||
if (sibling instanceof LeafNode) {
|
||||
return node.view;
|
||||
@ -635,7 +636,6 @@ export class Gridview implements IDisposable {
|
||||
const [grandParent, ..._] = [...pathToParent].reverse();
|
||||
const [parentIndex, ...__] = [...rest].reverse();
|
||||
|
||||
const sibling = parent.children[0];
|
||||
const isSiblingVisible = parent.isChildVisible(0);
|
||||
parent.removeChild(0, sizing);
|
||||
|
||||
|
@ -261,12 +261,10 @@ export class TabsContainer
|
||||
return;
|
||||
}
|
||||
|
||||
switch (event.kind) {
|
||||
case MouseEventKind.CLICK:
|
||||
this.group.model.openPanel(panel, {
|
||||
skipFocus: alreadyFocused,
|
||||
});
|
||||
break;
|
||||
if (event.kind === MouseEventKind.CLICK) {
|
||||
this.group.model.openPanel(panel, {
|
||||
skipFocus: alreadyFocused,
|
||||
});
|
||||
}
|
||||
}),
|
||||
tabToAdd.onDrop((event) => {
|
||||
|
@ -92,7 +92,6 @@ export class ReactPart<P extends object, C extends object = {}>
|
||||
throw new Error('invalid operation: resource is already disposed');
|
||||
}
|
||||
|
||||
// TODO use a better check for isReactFunctionalComponent
|
||||
if (typeof this.component !== 'function') {
|
||||
/**
|
||||
* we know this isn't a React.FunctionComponent so throw an error here.
|
||||
@ -100,7 +99,7 @@ export class ReactPart<P extends object, C extends object = {}>
|
||||
* for the same reason, at least at this point we will emit a sensible stacktrace.
|
||||
*/
|
||||
throw new Error(
|
||||
'invalid operation: only functional components are supported'
|
||||
'Invalid Operation. dockview only supports React Functional Components.'
|
||||
);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user