diff --git a/spec/app/pane-spec.coffee b/spec/app/pane-spec.coffee index e928bdd45..2ada044da 100644 --- a/spec/app/pane-spec.coffee +++ b/spec/app/pane-spec.coffee @@ -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 \ No newline at end of file + 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] diff --git a/src/app/pane.coffee b/src/app/pane.coffee index 006fd2d2a..64c186093 100644 --- a/src/app/pane.coffee +++ b/src/app/pane.coffee @@ -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