diff --git a/spec/workspace-element-spec.js b/spec/workspace-element-spec.js index d3027e574..48ed09cee 100644 --- a/spec/workspace-element-spec.js +++ b/spec/workspace-element-spec.js @@ -499,6 +499,21 @@ describe('WorkspaceElement', () => { expect(workspace.paneForItem(item)).toBe(startingPane) }) }) + + describe("when the item doesn't implement a `copy` function", () => { + it('does not copy the active item', function () { + const item = document.createElement('div') + const paneBelow = startingPane.splitDown() + expect(paneBelow.getItems().length).toEqual(0) + + startingPane.activate() + startingPane.activateItem(item) + workspaceElement.focusPaneViewAbove() + workspaceElement.moveActiveItemToNearestPaneInDirection('below', {keepOriginal: true}) + expect(workspace.paneForItem(item)).toBe(startingPane) + expect(paneBelow.getItems().length).toEqual(0) + }) + }) }) }) diff --git a/src/pane-container.js b/src/pane-container.js index 54cc4477d..c914cc37f 100644 --- a/src/pane-container.js +++ b/src/pane-container.js @@ -223,9 +223,9 @@ class PaneContainer { copyActiveItemToPane (destPane) { const item = this.activePane.copyActiveItem() - if (!destPane.isItemAllowed(item)) { return } - - destPane.activateItem(item) + if (item && destPane.isItemAllowed(item)) { + destPane.activateItem(item) + } } destroyEmptyPanes () {