aboutsummaryrefslogtreecommitdiffstats
path: root/test/unit
diff options
context:
space:
mode:
authorrwldrn <waldron.rick@gmail.com>2011-06-14 15:38:46 -0400
committertimmywil <tim.willison@thisismedium.com>2011-06-14 15:38:46 -0400
commit6926247bf441deaa0441872849bb3786c257a4cf (patch)
tree94b08fcfc6340afd28e2f97b83ea932cc5e3d78b /test/unit
parent641ad802111d2dc16ccf4b3721784a6addaf20df (diff)
downloadjquery-6926247bf441deaa0441872849bb3786c257a4cf.tar.gz
jquery-6926247bf441deaa0441872849bb3786c257a4cf.zip
Landing pull request 397. withinElement rewrite in event. Fixes #6234, #9357, #9447.
More Details: - https://github.com/jquery/jquery/pull/397 - http://bugs.jquery.com/ticket/6234 - http://bugs.jquery.com/ticket/9357 - http://bugs.jquery.com/ticket/9447
Diffstat (limited to 'test/unit')
-rw-r--r--test/unit/event.js37
1 files changed, 37 insertions, 0 deletions
diff --git a/test/unit/event.js b/test/unit/event.js
index f71c7b29f..7c628880b 100644
--- a/test/unit/event.js
+++ b/test/unit/event.js
@@ -780,6 +780,43 @@ test("mouseover triggers mouseenter", function() {
elem.remove();
});
+test("withinElement implemented with jQuery.contains()", function() {
+
+ expect(1);
+
+ jQuery("#qunit-fixture").append('<div id="jc-outer"><div id="jc-inner"></div></div>');
+
+ jQuery("#jc-outer").bind("mouseenter mouseleave", function( event ) {
+
+ equal( this.id, "jc-outer", this.id + " " + event.type );
+
+ }).trigger("mouseenter");
+
+ jQuery("#jc-inner").trigger("mousenter");
+
+ jQuery("#jc-outer").unbind("mouseenter mouseleave").remove();
+ jQuery("#jc-inner").remove();
+
+});
+
+test("mouseenter, mouseleave don't catch exceptions", function() {
+ expect(2);
+
+ var elem = jQuery("#firstp").hover(function() { throw "an Exception"; });
+
+ try {
+ elem.mouseenter();
+ } catch (e) {
+ equals( e, "an Exception", "mouseenter doesn't catch exceptions" );
+ }
+
+ try {
+ elem.mouseleave();
+ } catch (e) {
+ equals( e, "an Exception", "mouseleave doesn't catch exceptions" );
+ }
+});
+
test("trigger() shortcuts", function() {
expect(6);