X-Git-Url: http://git.asbjorn.biz/?a=blobdiff_plain;f=test%2Funit%2Fevent.js;h=1e40e0f3e6024cfb2c74d57d78c11e0ae57acfb6;hb=7705c35b140f378e407c196599cc738bc54c5cec;hp=d66aaac9baf9964c8722c1e50d3ca3536b87577a;hpb=2ac4067a639856a6035c3bd00aab132c9714b52d;p=jquery.git diff --git a/test/unit/event.js b/test/unit/event.js index d66aaac..1e40e0f 100644 --- a/test/unit/event.js +++ b/test/unit/event.js @@ -1980,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( '' ).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();