test quick dirty and under pressure

This commit is contained in:
Pierre Gerold 2015-12-11 15:38:36 +01:00
parent aefbdbf365
commit 94d057bf10

View File

@ -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];})
}));
});
});