fix tests on Firefox

Safari does not seem to allow overriding keyCode, probably for sandbox
reasons.