From b003b62de445d3b700949ebd44cbc239610af8f5 Mon Sep 17 00:00:00 2001 From: Matthias Bussonnier Date: Tue, 23 Dec 2014 22:29:51 +0100 Subject: [PATCH] Actually test that the j-nth cell. --- IPython/html/tests/util.js | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/IPython/html/tests/util.js b/IPython/html/tests/util.js index 6fd7be847..40b7ac5e0 100644 --- a/IPython/html/tests/util.js +++ b/IPython/html/tests/util.js @@ -394,7 +394,7 @@ casper.validate_notebook_state = function(message, mode, cell_index) { if (cell_index!==undefined) { // Is the specified cell the only cell in edit mode? this.test.assert(this.is_only_cell_edit(cell_index), - message + '; cell ' + cell_index + ' is the only cell in edit mode'); + message + '; cell ' + cell_index + ' is the only cell in edit mode '+ this.cells_modes()); // Is the specified cell the only cell with a focused code mirror? this.test.assert(this.is_cell_editor_focused(cell_index), message + '; cell ' + cell_index + '\'s editor is appropriately focused'); @@ -508,11 +508,11 @@ casper.is_only_cell_edit = function(index) { var cells_length = this.get_cells_length(); for (var j = 0; j < cells_length; j++) { if (j === index) { - if (!this.cell_mode_is('edit')) { + if (!this.cell_mode_is(j, 'edit')) { return false; } } else { - if (this.cell_mode_is('edit')) { + if (this.cell_mode_is(j, 'edit')) { return false; } } @@ -539,6 +539,11 @@ casper.is_only_cell_on = function(i, on_class, off_class) { return true; }; +casper.cells_modes = function(){ + return this.evaluate(function(){ + return IPython.notebook.get_cells().map(function(x,c){return x.mode}) + }, {}); +}; casper.cell_mode_is = function(index, mode) { // Check if a cell is in a specific mode