Show More
@@ -93,19 +93,6 b' casper.get_cells_length = function () {' | |||||
93 | return result; |
|
93 | return result; | |
94 | }; |
|
94 | }; | |
95 |
|
95 | |||
96 | // Inserts a cell at an index (see Notebook.insert_cell_at_index). |
|
|||
97 | // Returns the new cell's index. |
|
|||
98 | casper.insert_cell_at_index = function(cell_type, index){ |
|
|||
99 | if (cell_type===undefined) { |
|
|||
100 | cell_type = 'code'; |
|
|||
101 | } |
|
|||
102 |
|
||||
103 | return this.evaluate(function (cell_type, index) { |
|
|||
104 | var cell = IPython.notebook.insert_cell_at_index(cell_type, index); |
|
|||
105 | return IPython.notebook.find_cell_index(cell); |
|
|||
106 | }, cell_type, index); |
|
|||
107 | }; |
|
|||
108 |
|
||||
109 | // Set the text content of a cell. |
|
96 | // Set the text content of a cell. | |
110 | casper.set_cell_text = function(index, text){ |
|
97 | casper.set_cell_text = function(index, text){ | |
111 | this.evaluate(function (index, text) { |
|
98 | this.evaluate(function (index, text) { | |
@@ -114,12 +101,25 b' casper.set_cell_text = function(index, text){' | |||||
114 | }, index, text); |
|
101 | }, index, text); | |
115 | }; |
|
102 | }; | |
116 |
|
103 | |||
|
104 | // Inserts a cell at the bottom of the notebook | |||
|
105 | // Returns the new cell's index. | |||
|
106 | casper.insert_cell_at_bottom = function(cell_type){ | |||
|
107 | if (cell_type===undefined) { | |||
|
108 | cell_type = 'code'; | |||
|
109 | } | |||
|
110 | ||||
|
111 | return this.evaluate(function (cell_type) { | |||
|
112 | var cell = IPython.notebook.insert_cell_at_bottom(cell_type); | |||
|
113 | return IPython.notebook.find_cell_index(cell); | |||
|
114 | }, cell_type); | |||
|
115 | }; | |||
|
116 | ||||
117 | // Insert a cell at the bottom of the notebook and set the cells text. |
|
117 | // Insert a cell at the bottom of the notebook and set the cells text. | |
118 | // Returns the new cell's index. |
|
118 | // Returns the new cell's index. | |
119 | casper.append_cell = function(text, cell_type) { |
|
119 | casper.append_cell = function(text, cell_type) { | |
120 |
var index = insert_cell_at_ |
|
120 | var index = this.insert_cell_at_bottom(cell_type); | |
121 | if (text !== undefined) { |
|
121 | if (text !== undefined) { | |
122 | set_cell_text(index, text); |
|
122 | this.set_cell_text(index, text); | |
123 | } |
|
123 | } | |
124 | return index; |
|
124 | return index; | |
125 | }; |
|
125 | }; | |
@@ -142,7 +142,7 b' casper.execute_cell = function(index){' | |||||
142 | // when the cell has finished executing. |
|
142 | // when the cell has finished executing. | |
143 | // Returns the cell's index. |
|
143 | // Returns the cell's index. | |
144 | casper.execute_cell_then = function(index, then_callback) { |
|
144 | casper.execute_cell_then = function(index, then_callback) { | |
145 | var return_val = execute_cell(index); |
|
145 | var return_val = this.execute_cell(index); | |
146 |
|
146 | |||
147 | this.wait_for_output(index); |
|
147 | this.wait_for_output(index); | |
148 |
|
148 |
General Comments 0
You need to be logged in to leave comments.
Login now