Forgot to land Justin's tests for the event fixes.
[jquery.git] / test / unit / event.js
index fbb156f..9ce6e2f 100644 (file)
@@ -88,8 +88,9 @@ test("bind(), namespace with special add", function() {
                },
                setup: function(){},
                teardown: function(){},
-               add: function( handler, data, namespaces ) {
-                       return function(e) {
+               add: function( handleObj ) {
+                       var handler = handleObj.handler;
+                       handleObj.handler = function(e) {
                                e.xyz = ++i;
                                handler.apply( this, arguments );
                        };
@@ -299,6 +300,24 @@ test("bind(), multi-namespaced events", function() {
        jQuery("#firstp").trigger("custom");
 });
 
+test("bind(), with same function", function() {
+       expect(2)
+
+       var count = 0 ,  func = function(){
+               count++;
+       };
+
+       jQuery("#liveHandlerOrder").bind("foo.bar", func).bind("foo.zar", func);
+       jQuery("#liveHandlerOrder").trigger("foo.bar");
+
+       equals(count, 1, "Verify binding function with multiple namespaces." );
+
+       jQuery("#liveHandlerOrder").unbind("foo.bar", func).unbind("foo.zar", func);
+       jQuery("#liveHandlerOrder").trigger("foo.bar");
+
+       equals(count, 1, "Verify that removing events still work." );
+});
 test("bind(), with different this object", function() {
        expect(4);
        var thisObject = { myThis: true },