Side navigation
Ticket #3439: nondomeventtests.patch
File nondomeventtests.patch, 0.9 KB (added by morgan, October 02, 2008 09:00PM UTC)
Adds three test cases to event.js for non-DOM objects
Index: jquery/test/unit/event.js
===================================================================
--- jquery/test/unit/event.js (revision 5853)
+++ jquery/test/unit/event.js (working copy)
@@ -346,3 +346,26 @@
start();
}).click();
});
+
+test("Non DOM element events", function()
+{
+ expect(3);
+
+ jQuery({}).bind('nonelementglobal', function(e)
+ {
+ ok(true, "Global event on non-DOM annonymos object triggered");
+ });
+
+ var o = {};
+
+ jQuery(o).bind('nonelementobj', function(e)
+ {
+ ok(true, "Event on non-DOM object triggered");
+ }).bind('nonelementglobal', function()
+ {
+ ok(true, "Global event on non-DOM object triggered");
+ });
+
+ jQuery(o).trigger('nonelementobj');
+ jQuery.event.trigger('nonelementglobal');
+});
Download in other formats:
Original Format
File nondomeventtests.patch, 0.9 KB (added by morgan, October 02, 2008 09:00PM UTC)
Adds three test cases to event.js for non-DOM objects
Index: jquery/test/unit/event.js
===================================================================
--- jquery/test/unit/event.js (revision 5853)
+++ jquery/test/unit/event.js (working copy)
@@ -346,3 +346,26 @@
start();
}).click();
});
+
+test("Non DOM element events", function()
+{
+ expect(3);
+
+ jQuery({}).bind('nonelementglobal', function(e)
+ {
+ ok(true, "Global event on non-DOM annonymos object triggered");
+ });
+
+ var o = {};
+
+ jQuery(o).bind('nonelementobj', function(e)
+ {
+ ok(true, "Event on non-DOM object triggered");
+ }).bind('nonelementglobal', function()
+ {
+ ok(true, "Global event on non-DOM object triggered");
+ });
+
+ jQuery(o).trigger('nonelementobj');
+ jQuery.event.trigger('nonelementglobal');
+});