mirror of
https://github.com/jupyter/notebook.git
synced 2025-01-06 11:35:24 +08:00
add tests for cell_type preserving insertion
This commit is contained in:
parent
7778aed8a8
commit
9631028c1e
@ -18,10 +18,25 @@ casper.notebook_test(function () {
|
||||
this.select_cell(2);
|
||||
this.trigger_keydown('a'); // Creates one cell
|
||||
this.test.assertEquals(this.get_cell_text(2), '', 'a; New cell 2 text is empty');
|
||||
this.test.assertEquals(this.get_cell(2).cell_type, 'code', 'a; inserts a code cell when on code cell');
|
||||
this.validate_notebook_state('a', 'command', 2);
|
||||
this.trigger_keydown('b'); // Creates one cell
|
||||
this.test.assertEquals(this.get_cell_text(2), '', 'b; Cell 2 text is still empty');
|
||||
this.test.assertEquals(this.get_cell_text(3), '', 'b; New cell 3 text is empty');
|
||||
this.test.assertEquals(this.get_cell(3).cell_type, 'code', 'b; inserts a code cell when on code cell');
|
||||
this.validate_notebook_state('b', 'command', 3);
|
||||
});
|
||||
});
|
||||
this.then(function () {
|
||||
// Cell insertion
|
||||
this.select_cell(2);
|
||||
this.trigger_keydown('m'); // switch it to markdown for the next test
|
||||
this.trigger_keydown('a'); // Creates one cell
|
||||
this.test.assertEquals(this.get_cell_text(2), '', 'a; New cell 2 text is empty');
|
||||
this.test.assertEquals(this.get_cell(2).cell_type, 'markdown', 'a; inserts a markdown cell when on markdown cell');
|
||||
this.validate_notebook_state('a', 'command', 2);
|
||||
this.trigger_keydown('b'); // Creates one cell
|
||||
this.test.assertEquals(this.get_cell_text(2), '', 'b; Cell 2 text is still empty');
|
||||
this.test.assertEquals(this.get_cell(3).cell_type, 'markdown', 'b; inserts a markdown cell when on markdown cell');
|
||||
this.validate_notebook_state('b', 'command', 3);
|
||||
});
|
||||
});
|
||||
|
@ -167,8 +167,6 @@ casper.get_cell_text = function(index){
|
||||
casper.insert_cell_at_bottom = function(cell_type){
|
||||
// Inserts a cell at the bottom of the notebook
|
||||
// Returns the new cell's index.
|
||||
cell_type = cell_type || 'code';
|
||||
|
||||
return this.evaluate(function (cell_type) {
|
||||
var cell = IPython.notebook.insert_cell_at_bottom(cell_type);
|
||||
return IPython.notebook.find_cell_index(cell);
|
||||
|
Loading…
Reference in New Issue
Block a user