From 4460d5ad5949e5c9bf58d5de72b1d8b308181bf7 Mon Sep 17 00:00:00 2001 From: Brandon Aaron Date: Mon, 4 May 2009 04:54:09 +0000 Subject: [PATCH] unit tests for using jQuery events on non-dom elements. fixes #3439. thanks morgan --- test/unit/event.js | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/test/unit/event.js b/test/unit/event.js index dea17a12..63c640d1 100644 --- a/test/unit/event.js +++ b/test/unit/event.js @@ -688,6 +688,27 @@ test(".live()/.die()", function() { jQuery('span#liveSpan1').die('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'); +}); + /* test("jQuery(function($) {})", function() { stop();