X-Git-Url: http://git.asbjorn.biz/?a=blobdiff_plain;f=test%2Funit%2Fevent.js;h=16cfb6ce9530b6c99f114bfb7575ff44bf9818e4;hb=8356871a5522ad59cac80af2ca4695079059b97e;hp=d324432767ea0dba58bddccb5676f6efdfab53aa;hpb=811891785f5bfa3f42ec9cb18e68fc3a114935e9;p=jquery.git diff --git a/test/unit/event.js b/test/unit/event.js index d324432..16cfb6c 100644 --- a/test/unit/event.js +++ b/test/unit/event.js @@ -337,7 +337,7 @@ test("trigger() bubbling", function() { }); test("trigger(type, [data], [fn])", function() { - expect(11); + expect(12); var handler = function(event, a, b, c) { equals( event.type, "click", "check passed data" ); @@ -374,6 +374,14 @@ test("trigger(type, [data], [fn])", function() { pass = false; } ok( pass, "Trigger focus on hidden element" ); + + pass = true; + try { + jQuery('table:first').bind('test:test', function(){}).trigger('test:test'); + } catch (e) { + pass = false; + } + ok( pass, "Trigger on a table with a colon in the even type, see #3533" ); }); test("trigger(eventObject, [data], [fn])", function() { @@ -737,6 +745,43 @@ test(".live()/.die()", function() { jQuery('span#liveSpan1').die('click'); }); +test("live with focus/blur", function(){ + expect(2); + + // Setup + jQuery("").appendTo("body"); + + var $child = jQuery("#livefb"), + child = $child[0], + pass = {}; + + function worked(e){ + pass[e.type] = true; + } + + $child.live("focus", worked); + $child.live("blur", worked); + + // Test + child.focus(); + if (pass.focus) + ok(true, "Test live() with focus event"); + else + ok(true, "Cannot test focus because the window isn't focused"); + + child.blur(); + if (pass.blur) + ok( true, "Test live() with blur event"); + else + ok(true, "Cannot test blur because the window isn't focused"); + + // Teardown + $child.die("focus", worked); + $child.die("blur", worked); + $child.remove(); + window.scrollTo(0,0); +}); + test("Non DOM element events", function() { expect(3);