From: Scott González Date: Mon, 4 Apr 2011 15:53:19 +0000 (-0400) Subject: Accordion: Pass original event in beforeActivate event. X-Git-Tag: 1.9m5~147 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=80b6de1b7877f228f7fc5ce1a85766538f4218a1;p=jquery-ui.git Accordion: Pass original event in beforeActivate event. --- diff --git a/tests/unit/accordion/accordion_events.js b/tests/unit/accordion/accordion_events.js index 0b9f14706..f7d9aabef 100644 --- a/tests/unit/accordion/accordion_events.js +++ b/tests/unit/accordion/accordion_events.js @@ -3,7 +3,7 @@ module( "accordion: events", accordionSetupTeardown() ); test( "beforeActivate", function() { - expect( 42 ); + expect( 47 ); var ac = $( "#list1" ).accordion({ active: false, collapsible: true @@ -12,6 +12,7 @@ test( "beforeActivate", function() { var content = ac.find( ".ui-accordion-content" ); ac.one( "accordionbeforeactivate", function( event, ui ) { + ok( !( "originalEvent" in event ) ); equals( ui.oldHeader.size(), 0 ); equals( ui.oldContent.size(), 0 ); equals( ui.newHeader.size(), 1 ); @@ -24,6 +25,7 @@ test( "beforeActivate", function() { state( ac, 1, 0, 0 ); ac.one( "accordionbeforeactivate", function( event, ui ) { + equals( event.originalEvent.type, "click" ); equals( ui.oldHeader.size(), 1 ); strictEqual( ui.oldHeader[ 0 ], headers[ 0 ] ); equals( ui.oldContent.size(), 1 ); @@ -38,6 +40,7 @@ test( "beforeActivate", function() { state( ac, 0, 1, 0 ); ac.one( "accordionbeforeactivate", function( event, ui ) { + ok( !( "originalEvent" in event ) ); equals( ui.oldHeader.size(), 1 ); strictEqual( ui.oldHeader[ 0 ], headers[ 1 ] ); equals( ui.oldContent.size(), 1 ); @@ -50,6 +53,7 @@ test( "beforeActivate", function() { state( ac, 0, 0, 0 ); ac.one( "accordionbeforeactivate", function( event, ui ) { + ok( !( "originalEvent" in event ) ); equals( ui.oldHeader.size(), 0 ); equals( ui.oldContent.size(), 0 ); equals( ui.newHeader.size(), 1 ); @@ -63,6 +67,7 @@ test( "beforeActivate", function() { state( ac, 0, 0, 0 ); ac.one( "accordionbeforeactivate", function( event, ui ) { + equals( event.originalEvent.type, "click" ); equals( ui.oldHeader.size(), 0 ); equals( ui.oldContent.size(), 0 ); equals( ui.newHeader.size(), 1 ); diff --git a/ui/jquery.ui.accordion.js b/ui/jquery.ui.accordion.js index 95fa1d163..c658d4dbb 100644 --- a/ui/jquery.ui.accordion.js +++ b/ui/jquery.ui.accordion.js @@ -319,7 +319,7 @@ $.widget( "ui.accordion", { // click on active header, but not collapsible ( clickedIsActive && !options.collapsible ) || // allow canceling activation - ( this._trigger( "beforeActivate", null, eventData ) === false ) ) { + ( this._trigger( "beforeActivate", event, eventData ) === false ) ) { return; }