Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Fetching contributors…

Cannot retrieve contributors at this time

88 lines (74 sloc) 2.784 kb
<!DOCTYPE html>
<meta charset=utf-8>
<link href="peanutbutter.css" rel="stylesheet">
<h1>Peanut Butter</h1>
<p>For testing mousetrap</p>
<p>When the row is highlighted press the key(s). If you can't get anything to happen for a certain test press the f key to mark it as a failure</p>
<script src="jquery-1.7.2.min.js"></script>
<script src="../mousetrap.js"></script>
<script src="peanutbutter.js"></script>
PeanutButter.addTest('a', ['keypress']);
PeanutButter.addTest('A', ['keypress']);
PeanutButter.addTest('*', ['keypress']);
PeanutButter.addTest('?', ['keypress']);
// this works with keypress
// PeanutButter.addTest('', ['keypress']);
PeanutButter.addTest('a', ['keydown', 'keyup']);
PeanutButter.addTest(',', ['keydown', 'keyup']);
PeanutButter.addTest('7', ['keydown', 'keyup']);
PeanutButter.addTest('enter', ['keydown', 'keyup']);
PeanutButter.addTest('*', ['keydown', 'keyup']);
PeanutButter.addTest('?', ['keydown', 'keyup']);
PeanutButter.addTest('f1', ['keydown', 'keyup']);
// for whatever reason command key combos don't work with keyup
PeanutButter.addTest('command+a', ['keydown']);
PeanutButter.addTest('command+shift+k', ['keydown']);
PeanutButter.addTest('shift+a', ['keydown', 'keyup']);
PeanutButter.addTest('option+a', ['keydown', 'keyup']);
PeanutButter.addTest('ctrl+shift+up', ['keydown', 'keyup']);
// sequences need to be one or the other, so they
// can't happen in the same test
PeanutButter.addTest('* a', ['keypress']);
PeanutButter.addTest('* a', ['keydown']);
// key up with a modifier key is hard but possible
PeanutButter.addTest('* a', ['keyup']);
PeanutButter.addTest('k e y s', ['keypress']);
PeanutButter.addTest('k e y s', ['keydown']);
PeanutButter.addTest('k e y s', ['keyup']);
PeanutButter.addTest('left right left right', ['keydown']);
PeanutButter.addTest('left right left right', ['keyup']);
// sequence with modifier
PeanutButter.addTest('k command+u', ['keydown']);
PeanutButter.addTest('g .', ['keydown']);
PeanutButter.addTest('. g', ['keydown']);
PeanutButter.addTest('space command', ['keydown']);
// will not work in firefox
// there is currently no way to prevent default on each key in a sequence
// PeanutButter.addTest('command+k command+u', ['keyup']);
Jump to Line
Something went wrong with that request. Please try again.