added a shorthand way to trigger keyboard events

as suggested by @ellisonbg in #4285
use new press_up and press_down utils functions
a test of the arrow keys for non-empty notebook
make confusing code snippet more readable