##// END OF EJS Templates
add tests for cell_type preserving insertion
Paul Ivanov -
Show More
@@ -18,10 +18,25 b' casper.notebook_test(function () {'
18 this.select_cell(2);
18 this.select_cell(2);
19 this.trigger_keydown('a'); // Creates one cell
19 this.trigger_keydown('a'); // Creates one cell
20 this.test.assertEquals(this.get_cell_text(2), '', 'a; New cell 2 text is empty');
20 this.test.assertEquals(this.get_cell_text(2), '', 'a; New cell 2 text is empty');
21 this.test.assertEquals(this.get_cell(2).cell_type, 'code', 'a; inserts a code cell when on code cell');
21 this.validate_notebook_state('a', 'command', 2);
22 this.validate_notebook_state('a', 'command', 2);
22 this.trigger_keydown('b'); // Creates one cell
23 this.trigger_keydown('b'); // Creates one cell
23 this.test.assertEquals(this.get_cell_text(2), '', 'b; Cell 2 text is still empty');
24 this.test.assertEquals(this.get_cell_text(2), '', 'b; Cell 2 text is still empty');
24 this.test.assertEquals(this.get_cell_text(3), '', 'b; New cell 3 text is empty');
25 this.test.assertEquals(this.get_cell_text(3), '', 'b; New cell 3 text is empty');
26 this.test.assertEquals(this.get_cell(3).cell_type, 'code', 'b; inserts a code cell when on code cell');
25 this.validate_notebook_state('b', 'command', 3);
27 this.validate_notebook_state('b', 'command', 3);
26 });
28 });
27 }); No newline at end of file
29 this.then(function () {
30 // Cell insertion
31 this.select_cell(2);
32 this.trigger_keydown('m'); // switch it to markdown for the next test
33 this.trigger_keydown('a'); // Creates one cell
34 this.test.assertEquals(this.get_cell_text(2), '', 'a; New cell 2 text is empty');
35 this.test.assertEquals(this.get_cell(2).cell_type, 'markdown', 'a; inserts a markdown cell when on markdown cell');
36 this.validate_notebook_state('a', 'command', 2);
37 this.trigger_keydown('b'); // Creates one cell
38 this.test.assertEquals(this.get_cell_text(2), '', 'b; Cell 2 text is still empty');
39 this.test.assertEquals(this.get_cell(3).cell_type, 'markdown', 'b; inserts a markdown cell when on markdown cell');
40 this.validate_notebook_state('b', 'command', 3);
41 });
42 });
@@ -167,8 +167,6 b' casper.get_cell_text = function(index){'
167 casper.insert_cell_at_bottom = function(cell_type){
167 casper.insert_cell_at_bottom = function(cell_type){
168 // Inserts a cell at the bottom of the notebook
168 // Inserts a cell at the bottom of the notebook
169 // Returns the new cell's index.
169 // Returns the new cell's index.
170 cell_type = cell_type || 'code';
171
172 return this.evaluate(function (cell_type) {
170 return this.evaluate(function (cell_type) {
173 var cell = IPython.notebook.insert_cell_at_bottom(cell_type);
171 var cell = IPython.notebook.insert_cell_at_bottom(cell_type);
174 return IPython.notebook.find_cell_index(cell);
172 return IPython.notebook.find_cell_index(cell);
General Comments 0
You need to be logged in to leave comments. Login now