##// END OF EJS Templates
add (failling) roundtrip test case
Paul Ivanov -
Show More
@@ -7,7 +7,7 b' casper.notebook_test(function () {'
7 7 // "we have to make messes to find out who we are"
8 8 cell.set_text([
9 9 "%%javascript",
10 "IPython.notebook.insert_cell_above('code')"
10 "IPython.notebook.insert_cell_below('code')"
11 11 ].join('\n')
12 12 );
13 13
@@ -17,14 +17,36 b' casper.notebook_test(function () {'
17 17 this.wait_for_output(0);
18 18
19 19 this.then(function ( ) {
20 var result = this.get_output_cell(1);
20 var result = this.get_output_cell(0);
21 21 var num_cells = this.get_cells_length();
22 22 this.test.assertEquals(num_cells, 2, '%%javascript magic works');
23 this.test.assertTrue(result.hasOwnProperty('application/javascript'), 'JS embeded with mime key');
23 this.test.assertTrue(result.hasOwnProperty('application/javascript'),
24 'JS embeded with mime key');
24 25 });
25 26
27 //this.thenEvaluate(function() { IPython.notebook.save_notebook(); });
28
29 this.then(function ( ) {
30 json = this.evaluate(function() {
31 // the appended cell will initiall be empty
32 var json = IPython.notebook.get_cell(0).output_area.toJSON();
33 var cell = IPython.notebook.get_cell(1).output_area.fromJSON(json);
34 return json;
35 });
36 var result = this.get_output_cell(0);
37 var result2 = this.get_output_cell(1);
38 this.test.assertTrue(result.hasOwnProperty('application/javascript'),
39 'embeded JS keeps mime key after save');
40 this.test.assertTrue(json[0].hasOwnProperty('javascript'),
41 'JSON representation uses short keys');
42 this.test.assertTrue(result2.hasOwnProperty('application/javascript'),
43 'embeded JS keeps mime key on fromJSON');
44
45 });
26 46
27 //this.thenEvaluate(function () { var cell = IPython.notebook.get_cell(0);
47
48 //this.thenEvaluate(function () {
49 //var cell = IPython.notebook.get_cell(0);
28 50
29 51 // // we have to make messes to find out who we are
30 52 // cell.set_text([
@@ -38,11 +60,4 b' casper.notebook_test(function () {'
38 60 //
39 61 //this.wait_for_output(0);
40 62
41 //this.then(function ( ) {
42 // var result = this.get_output_cell(0);
43 // var num_cells = this.get_cells_length();
44 // this.test.assertEquals(result.text, '10\n', 'opening notebook JSON');
45 // this.test.assertEquals(num_cells, 2, ' %%javascript magic works')
46 //});
47
48 63 });
General Comments 0
You need to be logged in to leave comments. Login now