From da26d0eb4e7f563da72cf4d5e9a1d99f6719fea4 Mon Sep 17 00:00:00 2001 From: jeresig Date: Tue, 9 Mar 2010 14:08:33 -0500 Subject: [PATCH] Rewrote the live/delegate submit tests to be more generic. --- test/unit/event.js | 26 ++++++-------------------- 1 file changed, 6 insertions(+), 20 deletions(-) diff --git a/test/unit/event.js b/test/unit/event.js index f800fd5c0..3d401ba7e 100644 --- a/test/unit/event.js +++ b/test/unit/event.js @@ -1297,16 +1297,9 @@ test("live with submit", function() { ev.preventDefault(); }); - if ( jQuery.support.submitBubbles ) { - jQuery("#testForm input[name=sub1]")[0].click(); - equals(count1,1 ); - equals(count2,1); - } else { - jQuery("#testForm input[name=sub1]")[0].click(); - jQuery("#testForm input[name=T1]").trigger({type: "keypress", keyCode: 13}); - equals(count1,2); - equals(count2,2); - } + jQuery("#testForm input[name=sub1]").submit(); + equals( count1, 1, "Verify form submit." ); + equals( count2, 1, "Verify body submit." ); jQuery("#testForm").die("submit"); jQuery("body").die("submit"); @@ -1773,16 +1766,9 @@ test("delegate with submit", function() { ev.preventDefault(); }); - if ( jQuery.support.submitBubbles ) { - jQuery("#testForm input[name=sub1]")[0].click(); - equals(count1,1 ); - equals(count2,1); - } else { - jQuery("#testForm input[name=sub1]")[0].click(); - jQuery("#testForm input[name=T1]").trigger({type: "keypress", keyCode: 13}); - equals(count1,2); - equals(count2,2); - } + jQuery("#testForm input[name=sub1]").submit(); + equals( count1, 1, "Verify form submit." ); + equals( count2, 1, "Verify body submit." ); jQuery("#body").undelegate(); jQuery(document).undelegate(); -- 2.39.5