aboutsummaryrefslogtreecommitdiffstats
path: root/test/unit/event.js
diff options
context:
space:
mode:
authorOleg <markelog@gmail.com>2012-11-18 22:53:24 +0400
committerDave Methvin <dave.methvin@gmail.com>2012-12-11 22:06:26 -0500
commit93e18922c5b6f6c1472cc0b44c65c70603d57cdd (patch)
treecc7285ff32c2a108bcc984932abdbe9709d4f836 /test/unit/event.js
parentf42e1e654f43e9207c5b2f651c410f344982c2b5 (diff)
downloadjquery-93e18922c5b6f6c1472cc0b44c65c70603d57cdd.tar.gz
jquery-93e18922c5b6f6c1472cc0b44c65c70603d57cdd.zip
Fix #12956. Improve cloneFixAttributes for IE9/10 case. Close gh-1034.
Remove clear(merge)Attributes hack
Diffstat (limited to 'test/unit/event.js')
-rw-r--r--test/unit/event.js49
1 files changed, 49 insertions, 0 deletions
diff --git a/test/unit/event.js b/test/unit/event.js
index 211d2d852..b5ad26d85 100644
--- a/test/unit/event.js
+++ b/test/unit/event.js
@@ -3104,4 +3104,53 @@ test( "Namespace preserved when passed an Event (#12739)", function() {
equal( triggered, 3, "foo.bar triggered" );
});
+test( "make sure events cloned correctly", 18, function() {
+ var clone,
+ fixture = jQuery("#qunit-fixture"),
+ checkbox = jQuery("#check1"),
+ p = jQuery("#firstp");
+ fixture.on( "click change", function( event, result ) {
+ ok( result, event.type + " on original element is fired" );
+
+ }).on( "click", "#firstp", function( event, result ) {
+ ok( result, "Click on original child element though delegation is fired" );
+
+ }).on( "change", "#check1", function( event, result ) {
+ ok( result, "Change on original child element though delegation is fired" );
+ });
+
+ p.on("click", function( event, result ) {
+ ok( true, "Click on original child element is fired" );
+ });
+
+ checkbox.on("change", function( event, result ) {
+ ok( true, "Change on original child element is fired" );
+ });
+
+ fixture.clone().click().change(); // 0 events should be fired
+
+ clone = fixture.clone( true );
+
+ clone.find("p:first").trigger( "click", true ); // 3 events should fire
+ clone.find("#check1").trigger( "change", true ); // 3 events should fire
+ clone.remove();
+
+ clone = fixture.clone( true, true );
+ clone.find("p:first").trigger( "click", true ); // 3 events should fire
+ clone.find("#check1").trigger( "change", true ); // 3 events should fire
+
+ fixture.off();
+ p.off();
+ checkbox.off();
+
+ p.click(); // 0 should be fired
+ checkbox.change(); // 0 should be fired
+
+ clone.find("p:first").trigger( "click", true ); // 3 events should fire
+ clone.find("#check1").trigger( "change", true ); // 3 events should fire
+ clone.remove();
+
+ clone.find("p:first").click(); // 0 should be fired
+ clone.find("#check1").change(); // 0 events should fire
+});