module( "accordion (deprecated): expanded active option, activate method", accordionSetupTeardown() );
test( "activate, numeric", function() {
+ expect( 5 );
var element = $( "#list1" ).accordion({ active: 1 });
accordion_state( element, 0, 1, 0 );
element.accordion( "activate", 2 );
});
test( "activate, numeric, collapsible:true", function() {
+ expect( 3 );
var element = $( "#list1" ).accordion({ collapsible: true });
element.accordion( "activate", 2 );
accordion_state( element, 0, 0, 1 );
});
test( "activate, boolean, collapsible: true", function() {
+ expect( 2 );
var element = $( "#list1" ).accordion({ collapsible: true });
element.accordion( "activate", 2 );
accordion_state( element, 0, 0, 1 );
});
test( "activate, boolean, collapsible: false", function() {
+ expect( 2 );
var element = $( "#list1" ).accordion();
element.accordion( "activate", 2 );
accordion_state( element, 0, 0, 1 );
});
test( "activate, string expression", function() {
+ expect( 4 );
var element = $( "#list1" ).accordion({ active: "h3:last" });
accordion_state( element, 0, 0, 1 );
element.accordion( "activate", ":first" );
});
test( "activate, jQuery or DOM element", function() {
+ expect( 3 );
var element = $( "#list1" ).accordion({ active: $( "#list1 h3:last" ) });
accordion_state( element, 0, 0, 1 );
element.accordion( "activate", $( "#list1 h3:first" ) );
});
test( "{ active: Selector }", function() {
+ expect( 2 );
var element = $("#list1").accordion({
active: "h3:last"
});
});
test( "{ active: Element }", function() {
+ expect( 2 );
var element = $( "#list1" ).accordion({
active: $( "#list1 h3:last" )[ 0 ]
});
});
test( "{ active: jQuery Object }", function() {
+ expect( 2 );
var element = $( "#list1" ).accordion({
active: $( "#list1 h3:last" )
});
module( "accordion (deprecated) - height options", accordionSetupTeardown() );
test( "{ autoHeight: true }, default", function() {
- equalHeights($('#navigation').accordion({ autoHeight: true }), 95, 130);
+ expect( 3 );
+ accordion_equalHeights( $( "#navigation" ).accordion({ autoHeight: true }), 95, 130 );
});
-test("{ autoHeight: false }", function() {
- var element = $('#navigation').accordion({ autoHeight: false });
+test( "{ autoHeight: false }", function() {
+ expect( 3 );
+ var element = $( "#navigation" ).accordion({ autoHeight: false });
var sizes = [];
- element.find(".ui-accordion-content").each(function() {
- sizes.push($(this).height());
+ element.find( ".ui-accordion-content" ).each(function() {
+ sizes.push( $(this).height() );
});
ok( sizes[0] >= 70 && sizes[0] <= 105, "was " + sizes[0] );
ok( sizes[1] >= 98 && sizes[1] <= 126, "was " + sizes[1] );
});
test( "{ fillSpace: true }", function() {
+ expect( 3 );
$( "#navigationWrapper" ).height( 500 );
var element = $( "#navigation" ).accordion({ fillSpace: true });
- equalHeights( element, 446, 458 );
+ accordion_equalHeights( element, 446, 458 );
});
test( "{ fillSapce: true } with sibling", function() {
+ expect( 3 );
$( "#navigationWrapper" ).height( 500 );
$( "<p>Lorem Ipsum</p>" )
.css({
})
.prependTo( "#navigationWrapper" );
var element = $( "#navigation" ).accordion({ fillSpace: true });
- equalHeights( element , 346, 358);
+ accordion_equalHeights( element , 346, 358);
});
test( "{ fillSpace: true } with multiple siblings", function() {
+ expect( 3 );
$( "#navigationWrapper" ).height( 500 );
$( "<p>Lorem Ipsum</p>" )
.css({
})
.prependTo( "#navigationWrapper" );
var element = $( "#navigation" ).accordion({ fillSpace: true });
- equalHeights( element, 296, 308 );
+ accordion_equalHeights( element, 296, 308 );
});
module( "accordion (deprecated) - icons", accordionSetupTeardown() );
test( "icons, headerSelected", function() {
+ expect( 3 );
var element = $( "#list1" ).accordion({
icons: { headerSelected: "a1", header: "h1" }
});
module( "accordion (deprecated) - resize", accordionSetupTeardown() );
test( "resize", function() {
+ expect( 6 );
var element = $( "#navigation" )
.parent()
.height( 300 )
.accordion({
heightStyle: "fill"
});
- equalHeights( element, 246, 258 );
+ accordion_equalHeights( element, 246, 258 );
element.parent().height( 500 );
element.accordion( "resize" );
- equalHeights( element, 446, 458 );
+ accordion_equalHeights( element, 446, 458 );
});
module( "accordion (deprecated) - navigation", accordionSetupTeardown() );
test( "{ navigation: true, navigationFilter: header }", function() {
+ expect( 2 );
var element = $( "#navigation" ).accordion({
navigation: true,
navigationFilter: function() {
});
test( "{ navigation: true, navigationFilter: content }", function() {
- var element = $("#navigation").accordion({
+ expect( 2 );
+ var element = $( "#navigation" ).accordion({
navigation: true,
navigationFilter: function() {
- return /\?p=1\.1\.3\.2$/.test(this.href);
+ return /\?p=1\.1\.3\.2$/.test( this.href );
}
});
equal( element.accordion( "option", "active" ), 2 );
module( "accordion: methods", accordionSetupTeardown() );
test( "destroy", function() {
- domEqual("#list1", function() {
- $("#list1").accordion().accordion("destroy");
+ expect( 1 );
+ domEqual( "#list1", function() {
+ $( "#list1" ).accordion().accordion( "destroy" );
});
});
test( "enable/disable", function() {
- var element = $('#list1').accordion();
+ expect( 3 );
+ var element = $( "#list1" ).accordion();
accordion_state( element, 1, 0, 0 );
element.accordion( "disable" );
element.accordion( "option", "active", 1 );
});
test( "refresh", function() {
+ expect( 6 );
var element = $( "#navigation" )
.parent()
.height( 300 )
.accordion({
heightStyle: "fill"
});
- equalHeights( element, 246, 258 );
+ accordion_equalHeights( element, 246, 258 );
element.parent().height( 500 );
element.accordion( "refresh" );
- equalHeights( element, 446, 458 );
+ accordion_equalHeights( element, 446, 458 );
});
}( jQuery ) );
module( "accordion: options", accordionSetupTeardown() );
test( "{ active: default }", function() {
+ expect( 2 );
var element = $( "#list1" ).accordion();
equal( element.accordion( "option", "active" ), 0 );
accordion_state( element, 1, 0, 0 );
});
test( "{ active: false }", function() {
+ expect( 7 );
var element = $( "#list1" ).accordion({
active: false,
collapsible: true
});
test( "{ active: Number }", function() {
+ expect( 8 );
var element = $( "#list1" ).accordion({
active: 2
});
if ( $.uiBackCompat === false ) {
test( "{ active: -Number }", function() {
+ expect( 8 );
var element = $( "#list1" ).accordion({
active: -1
});
// TODO: add animation tests
test( "{ collapsible: false }", function() {
+ expect( 4 );
var element = $( "#list1" ).accordion({
active: 1
});
});
test( "{ collapsible: true }", function() {
+ expect( 6 );
var element = $( "#list1" ).accordion({
active: 1,
collapsible: true
});
test( "{ event: null }", function() {
+ expect( 5 );
var element = $( "#list1" ).accordion({
event: null
});
});
test( "{ event: custom }", function() {
+ expect( 11 );
var element = $( "#list1" ).accordion({
event: "custom1 custom2"
});
});
test( "{ header: default }", function() {
+ expect( 2 );
// default: > li > :first-child,> :not(li):even
// > :not(li):even
accordion_state( $( "#list1" ).accordion(), 1, 0, 0);
});
test( "{ header: custom }", function() {
+ expect( 6 );
var element = $( "#navigationWrapper" ).accordion({
header: "h2"
});
});
test( "{ heightStyle: 'auto' }", function() {
+ expect( 3 );
var element = $( "#navigation" ).accordion({ heightStyle: "auto" });
- equalHeights( element, 95, 130 );
+ accordion_equalHeights( element, 95, 130 );
});
test( "{ heightStyle: 'content' }", function() {
+ expect( 3 );
var element = $( "#navigation" ).accordion({ heightStyle: "content" });
var sizes = element.find( ".ui-accordion-content" ).map(function() {
return $( this ).height();
});
test( "{ heightStyle: 'fill' }", function() {
+ expect( 3 );
$( "#navigationWrapper" ).height( 500 );
var element = $( "#navigation" ).accordion({ heightStyle: "fill" });
- equalHeights( element, 446, 458 );
+ accordion_equalHeights( element, 446, 458 );
});
test( "{ heightStyle: 'fill' } with sibling", function() {
+ expect( 3 );
$( "#navigationWrapper" ).height( 500 );
$( "<p>Lorem Ipsum</p>" )
.css({
})
.prependTo( "#navigationWrapper" );
var element = $( "#navigation" ).accordion({ heightStyle: "fill" });
- equalHeights( element , 346, 358);
+ accordion_equalHeights( element , 346, 358);
});
test( "{ heightStyle: 'fill' } with multiple siblings", function() {
+ expect( 3 );
$( "#navigationWrapper" ).height( 500 );
$( "<p>Lorem Ipsum</p>" )
.css({
})
.prependTo( "#navigationWrapper" );
var element = $( "#navigation" ).accordion({ heightStyle: "fill" });
- equalHeights( element, 296, 308 );
+ accordion_equalHeights( element, 296, 308 );
});
test( "{ icons: false }", function() {
+ expect( 8 );
var element = $( "#list1" );
function icons( on ) {
deepEqual( element.find( "span.ui-icon").length, on ? 3 : 0 );
});
test( "{ icons: hash }", function() {
+ expect( 3 );
var element = $( "#list1" ).accordion({
icons: { activeHeader: "a1", header: "h1" }
});