##// END OF EJS Templates
refactor clearing and executing first cell in test
Paul Ivanov -
Show More
@@ -49,6 +49,18 b' function check_output_area(output_type, keys) {'
49 49 }
50 50 }
51 51
52
53 // helper function to clear the first two cells, set the text of and execute
54 // the first one
55 function clear_and_execute(that, code) {
56 that.evaluate(function() {
57 IPython.notebook.get_cell(0).clear_output();
58 IPython.notebook.get_cell(1).clear_output();
59 });
60 that.set_cell_text(0, code);
61 that.execute_cell(0);
62 }
63
52 64 casper.notebook_test(function () {
53 65 this.evaluate(function () {
54 66 var cell = IPython.notebook.get_cell(0);
@@ -80,13 +92,7 b' casper.notebook_test(function () {'
80 92 });
81 93
82 94 this.then(function() {
83 // test output of text/plain and application/json keys
84 this.evaluate(function() {
85 IPython.notebook.get_cell(0).clear_output();
86 IPython.notebook.get_cell(1).clear_output();
87 });
88 this.set_cell_text(0, "%lsmagic");
89 this.execute_cell(0);
95 clear_and_execute(this, '%lsmagic');
90 96 });
91 97
92 98 this.then(function () {
@@ -94,12 +100,7 b' casper.notebook_test(function () {'
94 100 });
95 101
96 102 this.then(function() {
97 // test display of text/plain and application/json keys
98 this.evaluate(function() {
99 IPython.notebook.get_cell(0).clear_output();
100 IPython.notebook.get_cell(1).clear_output();
101 });
102 this.set_cell_text(0,
103 clear_and_execute(this,
103 104 "x = %lsmagic\nfrom IPython.display import display; display(x)");
104 105 this.execute_cell(0);
105 106 });
General Comments 0
You need to be logged in to leave comments. Login now