Permalink
Browse files

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

pressed in an empty notebook.
  • Loading branch information...
1 parent 6df4139 commit c904ba7149b66f0aaf867776f2a34b7888893878 @dwyde committed Apr 2, 2013
Showing with 31 additions and 0 deletions.
  1. +31 −0 IPython/frontend/html/notebook/tests/casperjs/test_cases/empty_nb_arrow_keys.js
@@ -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();
+});

0 comments on commit c904ba7

Please sign in to comment.