Rewrote the live/delegate submit tests to be more generic.

This commit is contained in:
jeresig 2010-03-09 14:08:33 -05:00
parent f68b46d7ab
commit da26d0eb4e

View file

@ -1297,16 +1297,9 @@ test("live with submit", function() {
ev.preventDefault(); ev.preventDefault();
}); });
if ( jQuery.support.submitBubbles ) { jQuery("#testForm input[name=sub1]").submit();
jQuery("#testForm input[name=sub1]")[0].click(); equals( count1, 1, "Verify form submit." );
equals(count1,1 ); equals( count2, 1, "Verify body submit." );
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").die("submit"); jQuery("#testForm").die("submit");
jQuery("body").die("submit"); jQuery("body").die("submit");
@ -1773,16 +1766,9 @@ test("delegate with submit", function() {
ev.preventDefault(); ev.preventDefault();
}); });
if ( jQuery.support.submitBubbles ) { jQuery("#testForm input[name=sub1]").submit();
jQuery("#testForm input[name=sub1]")[0].click(); equals( count1, 1, "Verify form submit." );
equals(count1,1 ); equals( count2, 1, "Verify body submit." );
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("#body").undelegate(); jQuery("#body").undelegate();
jQuery(document).undelegate(); jQuery(document).undelegate();