Fixing more JS tests.

This commit is contained in:
Brian E. Granger 2014-01-08 21:02:12 -08:00
parent d83b4ece91
commit 8d73a3ac05
2 changed files with 8 additions and 5 deletions

View File

@ -31,11 +31,13 @@ casper.notebook_test(function () {
var result = this.get_output_cell(0);
var num_cells = this.get_cells_length();
this.test.assertEquals(result.text, '11\n', 'cell execute (using ctrl-enter)');
this.test.assertEquals(num_cells, 1, ' ^--- does not add a new cell')
this.test.assertEquals(num_cells, 2, 'ctrl-enter adds a new cell at the bottom')
});
// do it again with the keyboard shortcut
this.thenEvaluate(function () {
IPython.notebook.select(1);
IPython.notebook.delete_cell();
var cell = IPython.notebook.get_cell(0);
cell.set_text('a=12; print(a)');
cell.clear_output();
@ -48,7 +50,7 @@ casper.notebook_test(function () {
var result = this.get_output_cell(0);
var num_cells = this.get_cells_length();
this.test.assertEquals(result.text, '12\n', 'cell execute (using shift-enter)');
this.test.assertEquals(num_cells, 2, ' ^--- adds a new cell')
this.test.assertEquals(num_cells, 1, 'shift-enter adds no new cell at the bottom')
});
// press the "play" triangle button in the toolbar

View File

@ -4,11 +4,12 @@
casper.notebook_test(function() {
var output = this.evaluate(function () {
// Fill in test data.
IPython.notebook.command_mode();
var set_cell_text = function () {
var cell_one = IPython.notebook.get_selected_cell();
cell_one.set_text('a = 5');
IPython.notebook.insert_cell_below('code');
IPython.utils.press(IPython.keycodes.b)
var cell_two = IPython.notebook.get_selected_cell();
cell_two.set_text('print(a)');
};
@ -31,7 +32,7 @@ casper.notebook_test(function() {
});
this.test.assertEquals(output.above, 'a = 5\nprint(a)',
'Successful insert_cell_above().');
'Successful merge_cell_above().');
this.test.assertEquals(output.below, 'a = 5\nprint(a)',
'Successful insert_cell_below().');
'Successful merge_cell_below().');
});