mirror of
https://github.com/atom/atom.git
synced 2026-01-23 05:48:10 -05:00
Pane serializes its serializable items
This commit is contained in:
committed by
probablycorey
parent
bee1efed5c
commit
568fcf441e
@@ -105,4 +105,9 @@ describe "Pane", ->
|
||||
describe ".itemForPath(path)", ->
|
||||
it "returns the item for which a call to .getPath() returns the given path", ->
|
||||
expect(pane.itemForPath(editSession1.getPath())).toBe editSession1
|
||||
expect(pane.itemForPath(editSession2.getPath())).toBe editSession2
|
||||
expect(pane.itemForPath(editSession2.getPath())).toBe editSession2
|
||||
|
||||
describe "serialization", ->
|
||||
it "can serialize and deserialize the pane and all its serializable items", ->
|
||||
newPane = deserialize(pane.serialize())
|
||||
expect(newPane.getItems()).toEqual [editSession1, editSession2]
|
||||
|
||||
@@ -10,8 +10,8 @@ class Pane extends View
|
||||
@div class: 'pane', =>
|
||||
@div class: 'item-views', outlet: 'itemViews'
|
||||
|
||||
@deserialize: ({wrappedView}) ->
|
||||
new Pane(deserialize(wrappedView))
|
||||
@deserialize: ({items}) ->
|
||||
new Pane(items.map((item) -> deserialize(item))...)
|
||||
|
||||
currentItem: null
|
||||
items: null
|
||||
@@ -96,7 +96,7 @@ class Pane extends View
|
||||
|
||||
serialize: ->
|
||||
deserializer: "Pane"
|
||||
wrappedView: @wrappedView?.serialize()
|
||||
items: _.compact(@getItems().map (item) -> item.serialize?())
|
||||
|
||||
adjustDimensions: -> # do nothing
|
||||
|
||||
|
||||
Reference in New Issue
Block a user