diff --git a/notebook/tests/notebook/multiselect_toggle.js b/notebook/tests/notebook/multiselect_toggle.js index 1aff8cc66..fbe917285 100644 --- a/notebook/tests/notebook/multiselect_toggle.js +++ b/notebook/tests/notebook/multiselect_toggle.js @@ -65,6 +65,44 @@ casper.notebook_test(function () { this.test.assert(cell_outputs_cleared.every(function(cell_output_state) { return cell_output_state == ""; }), "ensure that all cells are cleared"); - + + /** + * Test the multiselection 2 moves down. + **/ + var result_indices = this.evaluate( function() { + Jupyter.notebook.select(0); + Jupyter.notebook.extend_selection_by(2); + var indices = Jupyter.notebook.get_selected_cells_indices(); + Jupyter.notebook.move_selection_down(); + Jupyter.notebook.move_selection_down(); + return Jupyter.notebook.get_selected_cells_indices(); + }); + var result = [2,3,4].entries(); + this.test.assert(result_indices.every( function(i){ return i === result.next().value[1];})) + + /** + * Test the multiselection move up at beginning of a Notebook + **/ + this.test.assert(this.evaluate( function() { + Jupyter.notebook.select(0); + Jupyter.notebook.extend_selection_by(2); + var indices_it = Jupyter.notebook.get_selected_cells_indices().entries(); + Jupyter.notebook.move_selection_up(); + var result = Jupyter.notebook.get_selected_cells_indices(); + return result.every( function(i){return i === indices_it.next().value[1];}) + })); + + /** + * Test the move down at the end of the notebook + **/ + this.test.assert(this.evaluate( function() { + var last_index = Jupyter.notebook.get_cells().length + Jupyter.notebook.select(last_index - 3); + Jupyter.notebook.extend_selection_by(2); + var indices.it() = Jupyter.notebook.get_selected_cells_indices().entries(); + Jupyter.notebook.move_selection_down(); + var result = Jupyter.notebook.get_selected_cells_indices(); + return result.every( function(i){return i === indices_it.next().value[1];}) + })); }); });