X-Git-Url: http://git.asbjorn.it/?a=blobdiff_plain;f=test%2Funit%2Fevent.js;h=43a4542f0c427627bc88500cfadc32a8fbd22c5e;hb=9bcd2b370b4aa72cc60af85d0f8a0872d0d17a0a;hp=73ce17cb200ef6068e8fafdbc95c90b0ff043492;hpb=b264f789b9a6995ad0e7eec6771fafa852717571;p=jquery.git diff --git a/test/unit/event.js b/test/unit/event.js index 73ce17c..43a4542 100644 --- a/test/unit/event.js +++ b/test/unit/event.js @@ -1,7 +1,7 @@ module("event"); test("bind()", function() { - expect(18); + expect(19); var handler = function(event) { ok( event.data, "bind() with data, check passed data exists" ); @@ -85,6 +85,11 @@ test("bind()", function() { $("#nonnodes").contents().bind("tester", function () { equals(this.nodeType, 1, "Check node,textnode,comment bind just does real nodes" ); }).trigger("tester"); + + // Make sure events stick with appendTo'd elements (which are cloned) #2027 + $("test").click(function(){ return false; }).appendTo("p"); + ok( $("a.test:first").triggerHandler("click") === false, "Handler is bound to appendTo'd elements" ); + reset(); }); test("click()", function() { @@ -217,6 +222,7 @@ test("trigger(event, [data], [fn])", function() { // Trigger only the handlers (no native) and extra fn, with external event obj // Triggers 9 + eventObj = jQuery.event.fix({ type: "foo", target: document.body }); equals( $("#firstp").triggerHandler("click", [eventObj, 1, "2", "abc"], handler), "test", "Verify handler response" ); var pass = true; @@ -263,3 +269,11 @@ test("toggle(Function, Function)", function() { return false; }).click().click().click(); }); + +test("jQuery(function($) {})", function() { + stop(); + jQuery(function($) { + equals(jQuery, $, "ready doesn't provide an event object, instead it provides a reference to the jQuery function, see http://docs.jquery.com/Events/ready#fn"); + start(); + }); +});