3 // test each of the following events
5 "focus","blur","change",
6 "submit","select","reset"
8 // test each event type
9 test( '"'+ type +'"', function(){
12 // custom event properties
14 //keyCode: Math.round( Math.random() * 256 ),
15 //charCode: Math.round( Math.random() * 256 ),
16 ctrlKey: Math.round( Math.random() ) ? true : false,
17 altKey: Math.round( Math.random() ) ? true : false,
18 shiftKey: Math.round( Math.random() ) ? true : false
21 $div = $('<div/>').appendTo( document.body );
22 // test the document too for bubbling
23 $div.add( document ).bind( type, function( ev ){
25 equals( ev.currentTarget, this, "event.currentTarget");
26 equals( ev.target, $div[0], "event.target" );
27 equals( ev.type, type, "event.type" );
29 equals( ev.ctrlKey, props.ctrlKey, "event.ctrlKey" );
30 equals( ev.altKey, props.altKey, "event.altKey" );
31 equals( ev.shiftKey, props.shiftKey, "event.shiftKey" );
32 equals( ev.metaKey, props.metaKey, "event.metaKey" );
33 equals( ev.bubbles, props.bubbles, "event.bubbles" );
36 // make sure that metaKey and ctrlKey are equal
37 props.metaKey = props.ctrlKey;
38 // fire the event with bubbling
40 $div.fire( type, props );
42 // fire the event without bubbling
43 props.bubbles = false;
44 $div.fire( type, props );
47 $( document ).unbind( type );