mirror of
https://github.com/atom/atom.git
synced 2026-01-24 14:28:14 -05:00
🐛 Don't attempt to copy items that aren't copyable
This commit is contained in:
@@ -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)
|
||||
})
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
|
||||
@@ -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 () {
|
||||
|
||||
Reference in New Issue
Block a user