Skip to content

Commit

Permalink
Accordion: Add panel in addition to content for create event. Fixes #…
Browse files Browse the repository at this point in the history
…8998 - Accordion: Create event uses content instead of panel.
  • Loading branch information
scottgonzalez committed Jan 22, 2013
1 parent 673c655 commit 10c873a
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
7 changes: 6 additions & 1 deletion tests/unit/accordion/accordion_events.js
Expand Up @@ -6,7 +6,7 @@ var setupTeardown = TestHelpers.accordion.setupTeardown,
module( "accordion: events", setupTeardown() );

test( "create", function() {
expect( 10 );
expect( 15 );

var element = $( "#list1" ),
headers = element.children( "h3" ),
Expand All @@ -16,6 +16,8 @@ test( "create", function() {
create: function( event, ui ) {
equal( ui.header.length, 1, "header length" );
strictEqual( ui.header[ 0 ], headers[ 0 ], "header" );
equal( ui.panel.length, 1, "panel length" );
strictEqual( ui.panel[ 0 ], contents[ 0 ], "panel" );
equal( ui.content.length, 1, "content length" );
strictEqual( ui.content[ 0 ], contents[ 0 ], "content" );
}
Expand All @@ -27,6 +29,8 @@ test( "create", function() {
create: function( event, ui ) {
equal( ui.header.length, 1, "header length" );
strictEqual( ui.header[ 0 ], headers[ 2 ], "header" );
equal( ui.panel.length, 1, "panel length" );
strictEqual( ui.panel[ 0 ], contents[ 2 ], "panel" );
equal( ui.content.length, 1, "content length" );
strictEqual( ui.content[ 0 ], contents[ 2 ], "content" );
}
Expand All @@ -38,6 +42,7 @@ test( "create", function() {
collapsible: true,
create: function( event, ui ) {
equal( ui.header.length, 0, "header length" );
equal( ui.panel.length, 0, "panel length" );
equal( ui.content.length, 0, "content length" );
}
});
Expand Down
1 change: 1 addition & 0 deletions ui/jquery.ui.accordion.js
Expand Up @@ -65,6 +65,7 @@ $.widget( "ui.accordion", {
_getCreateEventData: function() {
return {
header: this.active,
panel: !this.active.length ? $() : this.active.next(),
content: !this.active.length ? $() : this.active.next()
};
},
Expand Down

0 comments on commit 10c873a

Please sign in to comment.