mirror of
https://github.com/atom/atom.git
synced 2026-04-06 03:02:13 -04:00
Improve handling of pending items when moving items b/t panes
* Make pending items permanent when moved to new panes * Ensure existing pending items are not destroyed when a new item is added to the same pane Signed-off-by: Michelle Tilley <binarymuse@github.com>
This commit is contained in:
committed by
Michelle Tilley
parent
a4b57a31b7
commit
59b6c7f6fa
@@ -680,6 +680,23 @@ describe "Pane", ->
|
||||
expect(pane2.isDestroyed()).toBe true
|
||||
expect(item4.isDestroyed()).toBe false
|
||||
|
||||
describe "when the item being moved is pending", ->
|
||||
it "is made permanent in the new pane", ->
|
||||
item6 = new Item("F")
|
||||
pane1.addItem(item6, pending: true)
|
||||
expect(pane1.getPendingItem()).toEqual item6
|
||||
pane1.moveItemToPane(item6, pane2, 0)
|
||||
expect(pane2.getPendingItem()).not.toEqual item6
|
||||
|
||||
describe "when the target pane has a pending item", ->
|
||||
it "does not destroy the pending item", ->
|
||||
item6 = new Item("F")
|
||||
pane1.addItem(item6, pending: true)
|
||||
expect(pane1.getPendingItem()).toEqual item6
|
||||
pane2.moveItemToPane(item5, pane1, 0)
|
||||
expect(pane1.getPendingItem()).toEqual item6
|
||||
|
||||
|
||||
describe "split methods", ->
|
||||
[pane1, item1, container] = []
|
||||
|
||||
|
||||
@@ -404,7 +404,7 @@ class Pane extends Model
|
||||
@setPendingItem(item) if pending
|
||||
|
||||
@emitter.emit 'did-add-item', {item, index, moved}
|
||||
@destroyItem(lastPendingItem) if lastPendingItem?
|
||||
@destroyItem(lastPendingItem) if lastPendingItem? and not moved
|
||||
@setActiveItem(item) unless @getActiveItem()?
|
||||
item
|
||||
|
||||
|
||||
Reference in New Issue
Block a user