nexus site path corrected
[portal.git] / ecomp-portal-FE / client / bower_components / jquery.event.drag-new / fire / test / object.js
1 module("Object/Frame Events");
2
3 // test each of the following events
4 $.each([
5         "abort","scroll","resize",
6         "error","load","unload"
7 ],function( i, type ){
8         // test each event type
9         test( '"'+ type +'"', function(){
10                 expect( 0 );
11                 
12                 // custom event properties
13                 var props = {
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 
19                 },
20                 // new test element
21                 $div = $('<div/>').appendTo( document.body );
22                 // test the document too for bubbling
23                 $div.add( document ).bind( type, function( ev ){
24                         
25                         equals( ev.currentTarget, this, "event.currentTarget");
26                         equals( ev.target, $div[0], "event.target" );
27                         equals( ev.type, type, "event.type" );
28         
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" );
34                 });
35                 
36                 // make sure that metaKey and ctrlKey are equal
37                 props.metaKey = props.ctrlKey;
38                 // fire the event with bubbling
39                 props.bubbles = true;
40                 $div.fire( type, props );
41                 
42                 // fire the event without bubbling
43                 props.bubbles = false;
44                 $div.fire( type, props );
45         
46                 // cleanup
47                 $( document ).unbind( type );
48                 $div.remove();
49         });
50 });