Bug #8635 Firefox uncaught exception
[jquery.git] / test / unit / event.js
index 6b78a24..1e40e0f 100644 (file)
@@ -615,18 +615,18 @@ test("unbind(type)", function() {
 
        message = "unbind many with function";
        $elem.bind('error1 error2',error)
-                .unbind('error1 error2', error )
-                .trigger('error1').triggerHandler('error2');
+               .unbind('error1 error2', error )
+               .trigger('error1').triggerHandler('error2');
 
        message = "unbind many"; // #3538
        $elem.bind('error1 error2',error)
-                .unbind('error1 error2')
-                .trigger('error1').triggerHandler('error2');
+               .unbind('error1 error2')
+               .trigger('error1').triggerHandler('error2');
 
        message = "unbind without a type or handler";
        $elem.bind("error1 error2.test",error)
-                .unbind()
-                .trigger("error1").triggerHandler("error2");
+               .unbind()
+               .trigger("error1").triggerHandler("error2");
 });
 
 test("unbind(eventObject)", function() {
@@ -683,6 +683,20 @@ test("hover()", function() {
        equals( times, 4, "hover handlers fired" );
 });
 
+test("mouseover triggers mouseenter", function() {
+       expect(1);
+       
+       var count = 0,
+               elem = jQuery("<a />");
+       elem.mouseenter(function () {
+         count++;
+       });
+       elem.trigger('mouseover');
+       equals(count, 1, "make sure mouseover triggers a mouseenter" );
+       
+       elem.remove();
+});
+
 test("trigger() shortcuts", function() {
        expect(6);
 
@@ -1966,6 +1980,31 @@ test("window resize", function() {
        ok( !jQuery._data(window, "__events__"), "Make sure all the events are gone." );
 });
 
+test("focusin bubbles", function() {
+       expect(4);
+       
+       var input = jQuery( '<input type="text" />' ).prependTo( "body" ), 
+               order = 0;
+
+       jQuery( "body" ).bind( "focusin.focusinBubblesTest", function(){
+               equals( 1, order++, "focusin on the body second" );
+       });
+
+       input.bind( "focusin.focusinBubblesTest", function(){
+               equals( 0, order++, "focusin on the element first" );
+       });
+
+       // DOM focus method
+       input[0].focus();
+       // jQuery trigger, which calls DOM focus
+       order = 0;
+       input[0].blur();
+       input.trigger( "focus" );
+
+       input.remove();
+       jQuery( "body" ).unbind( "focusin.focusinBubblesTest" );
+});
+
 /*
 test("jQuery(function($) {})", function() {
        stop();