diff --git a/IPython/frontend/html/notebook/static/js/codecell.js b/IPython/frontend/html/notebook/static/js/codecell.js
index 81e1fc5..ed305aa 100644
--- a/IPython/frontend/html/notebook/static/js/codecell.js
+++ b/IPython/frontend/html/notebook/static/js/codecell.js
@@ -13,6 +13,7 @@ var IPython = (function (IPython) {
this.is_completing = false;
this.completion_cursor = null;
this.outputs = [];
+ this.collapsed = false;
IPython.Cell.apply(this, arguments);
};
@@ -317,12 +318,18 @@ var IPython = (function (IPython) {
CodeCell.prototype.collapse = function () {
- this.element.find('div.output').hide();
+ if (!this.collapsed) {
+ this.element.find('div.output').hide();
+ this.collapsed = true;
+ };
};
CodeCell.prototype.expand = function () {
- this.element.find('div.output').show();
+ if (this.collapsed) {
+ this.element.find('div.output').show();
+ this.collapsed = false;
+ };
};
@@ -378,6 +385,11 @@ var IPython = (function (IPython) {
for (var i=0; i',
diff --git a/IPython/nbformat/v2/tests/test_json.py b/IPython/nbformat/v2/tests/test_json.py
index d9a582a..1d05fa0 100644
--- a/IPython/nbformat/v2/tests/test_json.py
+++ b/IPython/nbformat/v2/tests/test_json.py
@@ -1,4 +1,4 @@
-
+import pprint
from unittest import TestCase
from ..nbjson import reads, writes
@@ -9,6 +9,12 @@ class TestJSON(TestCase):
def test_roundtrip(self):
s = writes(nb0)
+# print
+# print pprint.pformat(nb0,indent=2)
+# print
+# print pprint.pformat(reads(s),indent=2)
+# print
+# print s
self.assertEquals(reads(s),nb0)
diff --git a/IPython/nbformat/v2/tests/test_nbbase.py b/IPython/nbformat/v2/tests/test_nbbase.py
index 4eb42a2..f054165 100644
--- a/IPython/nbformat/v2/tests/test_nbbase.py
+++ b/IPython/nbformat/v2/tests/test_nbbase.py
@@ -13,9 +13,10 @@ class TestCell(TestCase):
self.assertEquals('input' not in cc, True)
self.assertEquals('prompt_number' not in cc, True)
self.assertEquals(cc.outputs, [])
+ self.assertEquals(cc.collapsed, False)
def test_code_cell(self):
- cc = new_code_cell(input='a=10', prompt_number=0)
+ cc = new_code_cell(input='a=10', prompt_number=0, collapsed=True)
cc.outputs = [new_output(output_type='pyout',
output_svg='foo',output_text='10',prompt_number=0)]
self.assertEquals(cc.input, u'a=10')
@@ -24,6 +25,8 @@ class TestCell(TestCase):
self.assertEquals(cc.outputs[0].svg, u'foo')
self.assertEquals(cc.outputs[0].text, u'10')
self.assertEquals(cc.outputs[0].prompt_number, 0)
+ self.assertEquals(cc.collapsed, True)
+
def test_empty_html_cell(self):
tc = new_text_cell(u'html')