Add a test to demonstrate errors when up/down arrow keys are

pressed in an empty notebook.
This commit is contained in:
David Wyde 2013-04-02 17:34:59 -05:00 committed by Paul Ivanov
parent 7f9aecc2d9
commit 6e7cd60cb5

View File

@ -0,0 +1,31 @@
//
// Check for errors with up and down arrow presses in an empty notebook.
//
casper.openNewNotebook();
casper.then(function () {
var result = this.evaluate(function() {
var ncells = IPython.notebook.ncells(),
i;
// Delete all cells.
for (i = 0; i < ncells; i++) {
IPython.notebook.delete_cell();
}
// Simulate the "up arrow" and "down arrow" keys.
var up_press = jQuery.Event("keydown", {which: 38});
$(document).trigger(up_press);
var down_press = jQuery.Event("keydown", {which: 40});
$(document).trigger(down_press);
return true;
});
casper.test.assertTrue(result, 'Trivial assertion to check for JS errors');
});
casper.deleteCurrentNotebook();
// Run the browser automation.
casper.run(function() {
this.test.done();
});