Accordion: Add panel in addition to content for create event. Fixes #8998 - Accordion: Create event uses content instead of panel.

This commit is contained in:
Scott González 2013-01-22 09:19:04 -05:00
parent 673c6558e0
commit 10c873ab6c
2 changed files with 7 additions and 1 deletions

View File

@ -6,7 +6,7 @@ var setupTeardown = TestHelpers.accordion.setupTeardown,
module( "accordion: events", setupTeardown() ); module( "accordion: events", setupTeardown() );
test( "create", function() { test( "create", function() {
expect( 10 ); expect( 15 );
var element = $( "#list1" ), var element = $( "#list1" ),
headers = element.children( "h3" ), headers = element.children( "h3" ),
@ -16,6 +16,8 @@ test( "create", function() {
create: function( event, ui ) { create: function( event, ui ) {
equal( ui.header.length, 1, "header length" ); equal( ui.header.length, 1, "header length" );
strictEqual( ui.header[ 0 ], headers[ 0 ], "header" ); 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" ); equal( ui.content.length, 1, "content length" );
strictEqual( ui.content[ 0 ], contents[ 0 ], "content" ); strictEqual( ui.content[ 0 ], contents[ 0 ], "content" );
} }
@ -27,6 +29,8 @@ test( "create", function() {
create: function( event, ui ) { create: function( event, ui ) {
equal( ui.header.length, 1, "header length" ); equal( ui.header.length, 1, "header length" );
strictEqual( ui.header[ 0 ], headers[ 2 ], "header" ); 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" ); equal( ui.content.length, 1, "content length" );
strictEqual( ui.content[ 0 ], contents[ 2 ], "content" ); strictEqual( ui.content[ 0 ], contents[ 2 ], "content" );
} }
@ -38,6 +42,7 @@ test( "create", function() {
collapsible: true, collapsible: true,
create: function( event, ui ) { create: function( event, ui ) {
equal( ui.header.length, 0, "header length" ); equal( ui.header.length, 0, "header length" );
equal( ui.panel.length, 0, "panel length" );
equal( ui.content.length, 0, "content length" ); equal( ui.content.length, 0, "content length" );
} }
}); });

View File

@ -65,6 +65,7 @@ $.widget( "ui.accordion", {
_getCreateEventData: function() { _getCreateEventData: function() {
return { return {
header: this.active, header: this.active,
panel: !this.active.length ? $() : this.active.next(),
content: !this.active.length ? $() : this.active.next() content: !this.active.length ? $() : this.active.next()
}; };
}, },