##// END OF EJS Templates
adjustments to nb_roundtrip.js...
MinRK -
Show More
@@ -27,9 +27,9 b' function assert_has(short_name, json, result, result2) {'
27 this.test.assertTrue(json[0].hasOwnProperty(short_name),
27 this.test.assertTrue(json[0].hasOwnProperty(short_name),
28 'toJSON() representation uses ' + short_name);
28 'toJSON() representation uses ' + short_name);
29 this.test.assertTrue(result.hasOwnProperty(long_name),
29 this.test.assertTrue(result.hasOwnProperty(long_name),
30 'toJSON() original embeded JSON keeps ' + long_name);
30 'toJSON() original embedded JSON keeps ' + long_name);
31 this.test.assertTrue(result2.hasOwnProperty(long_name),
31 this.test.assertTrue(result2.hasOwnProperty(long_name),
32 'fromJSON() embeded ' + short_name + ' gets mime key ' + long_name);
32 'fromJSON() embedded ' + short_name + ' gets mime key ' + long_name);
33 }
33 }
34
34
35 // helper function for checkout that the first two cells have a particular
35 // helper function for checkout that the first two cells have a particular
@@ -40,11 +40,11 b' function check_output_area(output_type, keys) {'
40 this.wait_for_output(0);
40 this.wait_for_output(0);
41 json = this.evaluate(function() {
41 json = this.evaluate(function() {
42 var json = IPython.notebook.get_cell(0).output_area.toJSON();
42 var json = IPython.notebook.get_cell(0).output_area.toJSON();
43 // appended cell will initially be empty, lets add it some output
43 // appended cell will initially be empty, let's add some output
44 var cell = IPython.notebook.get_cell(1).output_area.fromJSON(json);
44 IPython.notebook.get_cell(1).output_area.fromJSON(json);
45 return json;
45 return json;
46 });
46 });
47 // The evaluate call above happens asyncrhonously: wait for cell[1] to have output
47 // The evaluate call above happens asynchronously: wait for cell[1] to have output
48 this.wait_for_output(1);
48 this.wait_for_output(1);
49 var result = this.get_output_cell(0);
49 var result = this.get_output_cell(0);
50 var result2 = this.get_output_cell(1);
50 var result2 = this.get_output_cell(1);
@@ -88,12 +88,19 b' casper.notebook_test(function () {'
88 var num_cells = this.get_cells_length();
88 var num_cells = this.get_cells_length();
89 this.test.assertEquals(num_cells, 2, '%%javascript magic works');
89 this.test.assertEquals(num_cells, 2, '%%javascript magic works');
90 this.test.assertTrue(result.hasOwnProperty('application/javascript'),
90 this.test.assertTrue(result.hasOwnProperty('application/javascript'),
91 'testing JS embeded with mime key');
91 'testing JS embedded with mime key');
92 });
92 });
93
93
94 //this.thenEvaluate(function() { IPython.notebook.save_notebook(); });
94 //this.thenEvaluate(function() { IPython.notebook.save_notebook(); });
95 this.then(function () {
96 clear_and_execute(this, [
97 "%%javascript",
98 "var a=5;"
99 ].join('\n'));
100 });
101
95
102
96 this.then(function ( ) {
103 this.then(function () {
97 check_output_area.apply(this, ['display_data', ['javascript']]);
104 check_output_area.apply(this, ['display_data', ['javascript']]);
98
105
99 });
106 });
@@ -223,7 +230,9 b' casper.notebook_test(function () {'
223
230
224 });
231 });
225
232
226 this.then(function ( ) {
233 this.wait_for_output(0, 1);
234
235 this.then(function () {
227 var long_name = 'text/superfancymimetype';
236 var long_name = 'text/superfancymimetype';
228 var result = this.get_output_cell(0);
237 var result = this.get_output_cell(0);
229 this.test.assertTrue(result.hasOwnProperty(long_name),
238 this.test.assertTrue(result.hasOwnProperty(long_name),
General Comments 0
You need to be logged in to leave comments. Login now