aboutsummaryrefslogtreecommitdiffstats
path: root/test/unit
diff options
context:
space:
mode:
authorJason Moon <jmoon@socialcast.com>2012-05-21 18:01:59 -0500
committerDave Methvin <dave.methvin@gmail.com>2012-05-22 21:29:13 -0400
commit4757881759931bfddf32c26de6831f888b8cd20a (patch)
treeccbe8a6b755f0f4d5e9b8fcd0661a0f230e1c270 /test/unit
parentb5a84a48f4317a188aa78051d4f0cf12db9d7873 (diff)
downloadjquery-4757881759931bfddf32c26de6831f888b8cd20a.tar.gz
jquery-4757881759931bfddf32c26de6831f888b8cd20a.zip
Fix #11796. Preserve oldIE change delegation on clone. Closes gh-789.
Diffstat (limited to 'test/unit')
-rw-r--r--test/unit/event.js32
1 files changed, 32 insertions, 0 deletions
diff --git a/test/unit/event.js b/test/unit/event.js
index 78d14b675..db7065fd1 100644
--- a/test/unit/event.js
+++ b/test/unit/event.js
@@ -1098,6 +1098,38 @@ test( "submit event bubbles on copied forms (#11649)", function(){
$testForm.off( "submit", noSubmit );
});
+test( "change event bubbles on copied forms (#11796)", function(){
+ expect( 3 );
+
+ var $formByClone, $formByHTML,
+ $form = jQuery("#form"),
+ $fixture = jQuery("#qunit-fixture"),
+ $wrapperDiv = jQuery("<div/>").appendTo( $fixture );
+
+ function delegatedChange() {
+ ok( true, "Make sure change event bubbles up." );
+ return false;
+ }
+
+ // Attach a delegated change handler to the form
+ $fixture.on( "change", "form", delegatedChange );
+
+ // Trigger change event to introduce the _change_attached property
+ $form.find("select[name=select1]").val("1").change();
+
+ // Copy the form via .clone() and .html()
+ $formByClone = $form.clone( true, true ).removeAttr("id");
+ $formByHTML = jQuery( $fixture.html() ).filter("#form").removeAttr("id");
+ $wrapperDiv.append( $formByClone, $formByHTML );
+
+ // Check change bubbling on the copied forms
+ $wrapperDiv.find("form select[name=select1]").val("2").change();
+
+ // Clean up
+ $wrapperDiv.remove();
+ $fixture.off( "change", "form", delegatedChange );
+});
+
test("trigger(eventObject, [data], [fn])", function() {
expect(28);