var actual = accordion.find( ".ui-accordion-content" ).map(function() {
return $( this ).css( "display" ) === "none" ? 0 : 1;
}).get();
- same( actual, expected );
+ deepEqual( actual, expected );
}
function equalHeights( accordion, min, max ) {
var sizes = [];
});
ok( sizes[ 0 ] >= min && sizes[ 0 ] <= max,
"must be within " + min + " and " + max + ", was " + sizes[ 0 ] );
- same( sizes[ 0 ], sizes[ 1 ] );
- same( sizes[ 0 ], sizes[ 2 ] );
+ deepEqual( sizes[ 0 ], sizes[ 1 ] );
+ deepEqual( sizes[ 0 ], sizes[ 2 ] );
}
function accordionSetupTeardown() {
var animated = $.ui.accordion.prototype.options.animated;
".ui-accordion-header elements exist, correct number" );
equal( element.find( ".ui-accordion-content" ).length, 3,
".ui-accordion-content elements exist, correct number" );
- same( element.find( ".ui-accordion-header" ).next().get(),
+ deepEqual( element.find( ".ui-accordion-header" ).next().get(),
element.find( ".ui-accordion-content" ).get(),
"content panels come immediately after headers" );
});
expect( 1 );
var element = $( "#list1" ).accordion();
var anchors = element.find( ".ui-accordion-heading" );
- equals( anchors.length, 3 );
+ equal( anchors.length, 3 );
});
test( "accessibility", function () {
var element = $( "#list1" ).accordion().accordion( "option", "active", 1 );
var headers = element.find( ".ui-accordion-header" );
- equals( headers.eq( 1 ).attr( "tabindex" ), 0, "active header should have tabindex=0" );
- equals( headers.eq( 0 ).attr( "tabindex" ), -1, "inactive header should have tabindex=-1" );
- equals( element.attr( "role" ), "tablist", "main role" );
- equals( headers.attr( "role" ), "tab", "tab roles" );
- equals( headers.next().attr( "role" ), "tabpanel", "tabpanel roles" );
- equals( headers.eq( 1 ).attr( "aria-expanded" ), "true", "active tab has aria-expanded" );
- equals( headers.eq( 0 ).attr( "aria-expanded" ), "false", "inactive tab has aria-expanded" );
- equals( headers.eq( 1 ).attr( "aria-selected" ), "true", "active tab has aria-selected" );
- equals( headers.eq( 0 ).attr( "aria-selected" ), "false", "inactive tab has aria-selected" );
+ equal( headers.eq( 1 ).attr( "tabindex" ), 0, "active header should have tabindex=0" );
+ equal( headers.eq( 0 ).attr( "tabindex" ), -1, "inactive header should have tabindex=-1" );
+ equal( element.attr( "role" ), "tablist", "main role" );
+ equal( headers.attr( "role" ), "tab", "tab roles" );
+ equal( headers.next().attr( "role" ), "tabpanel", "tabpanel roles" );
+ equal( headers.eq( 1 ).attr( "aria-expanded" ), "true", "active tab has aria-expanded" );
+ equal( headers.eq( 0 ).attr( "aria-expanded" ), "false", "inactive tab has aria-expanded" );
+ equal( headers.eq( 1 ).attr( "aria-selected" ), "true", "active tab has aria-selected" );
+ equal( headers.eq( 0 ).attr( "aria-selected" ), "false", "inactive tab has aria-selected" );
element.accordion( "option", "active", 0 );
- equals( headers.eq( 0 ).attr( "aria-expanded" ), "true", "newly active tab has aria-expanded" );
- equals( headers.eq( 1 ).attr( "aria-expanded" ), "false", "newly inactive tab has aria-expanded" );
- equals( headers.eq( 0 ).attr( "aria-selected" ), "true", "active tab has aria-selected" );
- equals( headers.eq( 1 ).attr( "aria-selected" ), "false", "inactive tab has aria-selected" );
+ equal( headers.eq( 0 ).attr( "aria-expanded" ), "true", "newly active tab has aria-expanded" );
+ equal( headers.eq( 1 ).attr( "aria-expanded" ), "false", "newly inactive tab has aria-expanded" );
+ equal( headers.eq( 0 ).attr( "aria-selected" ), "true", "active tab has aria-selected" );
+ equal( headers.eq( 1 ).attr( "aria-selected" ), "false", "inactive tab has aria-selected" );
});
}( jQuery ) );
var actual = accordion.find( ".ui-accordion-content" ).map(function() {
return $( this ).css( "display" ) === "none" ? 0 : 1;
}).get();
- same( actual, expected );
+ deepEqual( actual, expected );
}
function equalHeights( accordion, min, max ) {
var sizes = [];
});
ok( sizes[ 0 ] >= min && sizes[ 0 ] <= max,
"must be within " + min + " and " + max + ", was " + sizes[ 0 ] );
- same( sizes[ 0 ], sizes[ 1 ] );
- same( sizes[ 0 ], sizes[ 2 ] );
+ deepEqual( sizes[ 0 ], sizes[ 1 ] );
+ deepEqual( sizes[ 0 ], sizes[ 2 ] );
}
function accordionSetupTeardown() {
var animated = $.ui.accordion.prototype.options.animated;
var content = element.find( ".ui-accordion-content" );
element.one( "accordionchangestart", function( event, ui ) {
- equals( ui.oldHeader.size(), 0 );
- equals( ui.oldContent.size(), 0 );
- equals( ui.newHeader.size(), 1 );
+ equal( ui.oldHeader.size(), 0 );
+ equal( ui.oldContent.size(), 0 );
+ equal( ui.newHeader.size(), 1 );
strictEqual( ui.newHeader[ 0 ], headers[ 0 ] );
- equals( ui.newContent.size(), 1 );
+ equal( ui.newContent.size(), 1 );
strictEqual( ui.newContent[ 0 ], content[ 0 ] );
accordion_state( element, 0, 0, 0 );
});
accordion_state( element, 1, 0, 0 );
element.one( "accordionchangestart", function( event, ui ) {
- equals( ui.oldHeader.size(), 1 );
+ equal( ui.oldHeader.size(), 1 );
strictEqual( ui.oldHeader[ 0 ], headers[ 0 ] );
- equals( ui.oldContent.size(), 1 );
+ equal( ui.oldContent.size(), 1 );
strictEqual( ui.oldContent[ 0 ], content[ 0 ] );
- equals( ui.newHeader.size(), 1 );
+ equal( ui.newHeader.size(), 1 );
strictEqual( ui.newHeader[ 0 ], headers[ 1 ] );
- equals( ui.newContent.size(), 1 );
+ equal( ui.newContent.size(), 1 );
strictEqual( ui.newContent[ 0 ], content[ 1 ] );
accordion_state( element, 1, 0, 0 );
});
accordion_state( element, 0, 1, 0 );
element.one( "accordionchangestart", function( event, ui ) {
- equals( ui.oldHeader.size(), 1 );
+ equal( ui.oldHeader.size(), 1 );
strictEqual( ui.oldHeader[ 0 ], headers[ 1 ] );
- equals( ui.oldContent.size(), 1 );
+ equal( ui.oldContent.size(), 1 );
strictEqual( ui.oldContent[ 0 ], content[ 1 ] );
- equals( ui.newHeader.size(), 0 );
- equals( ui.newContent.size(), 0 );
+ equal( ui.newHeader.size(), 0 );
+ equal( ui.newContent.size(), 0 );
accordion_state( element, 0, 1, 0 );
});
element.accordion( "option", "active", false );
var content = element.find( ".ui-accordion-content" );
element.one( "accordionchange", function( event, ui ) {
- equals( ui.oldHeader.size(), 0 );
- equals( ui.oldContent.size(), 0 );
- equals( ui.newHeader.size(), 1 );
+ equal( ui.oldHeader.size(), 0 );
+ equal( ui.oldContent.size(), 0 );
+ equal( ui.newHeader.size(), 1 );
strictEqual( ui.newHeader[ 0 ], headers[ 0 ] );
- equals( ui.newContent.size(), 1 );
+ equal( ui.newContent.size(), 1 );
strictEqual( ui.newContent[ 0 ], content[ 0 ] );
});
element.accordion( "option", "active", 0 );
element.one( "accordionchange", function( event, ui ) {
- equals( ui.oldHeader.size(), 1 );
+ equal( ui.oldHeader.size(), 1 );
strictEqual( ui.oldHeader[ 0 ], headers[ 0 ] );
- equals( ui.oldContent.size(), 1 );
+ equal( ui.oldContent.size(), 1 );
strictEqual( ui.oldContent[ 0 ], content[ 0 ] );
- equals( ui.newHeader.size(), 1 );
+ equal( ui.newHeader.size(), 1 );
strictEqual( ui.newHeader[ 0 ], headers[ 1 ] );
- equals( ui.newContent.size(), 1 );
+ equal( ui.newContent.size(), 1 );
strictEqual( ui.newContent[ 0 ], content[ 1 ] );
});
headers.eq( 1 ).click();
element.one( "accordionchange", function( event, ui ) {
- equals( ui.oldHeader.size(), 1 );
+ equal( ui.oldHeader.size(), 1 );
strictEqual( ui.oldHeader[ 0 ], headers[ 1 ] );
- equals( ui.oldContent.size(), 1 );
+ equal( ui.oldContent.size(), 1 );
strictEqual( ui.oldContent[ 0 ], content[ 1 ] );
- equals( ui.newHeader.size(), 0 );
- equals( ui.newContent.size(), 0 );
+ equal( ui.newHeader.size(), 0 );
+ equal( ui.newContent.size(), 0 );
});
element.accordion( "option", "active", false );
});
element.one( "accordionbeforeactivate", function( event, ui ) {
ok( !( "originalEvent" in event ) );
- equals( ui.oldHeader.size(), 0 );
- equals( ui.oldContent.size(), 0 );
- equals( ui.newHeader.size(), 1 );
+ equal( ui.oldHeader.size(), 0 );
+ equal( ui.oldContent.size(), 0 );
+ equal( ui.newHeader.size(), 1 );
strictEqual( ui.newHeader[ 0 ], headers[ 0 ] );
- equals( ui.newContent.size(), 1 );
+ equal( ui.newContent.size(), 1 );
strictEqual( ui.newContent[ 0 ], content[ 0 ] );
accordion_state( element, 0, 0, 0 );
});
accordion_state( element, 1, 0, 0 );
element.one( "accordionbeforeactivate", function( event, ui ) {
- equals( event.originalEvent.type, "click" );
- equals( ui.oldHeader.size(), 1 );
+ equal( event.originalEvent.type, "click" );
+ equal( ui.oldHeader.size(), 1 );
strictEqual( ui.oldHeader[ 0 ], headers[ 0 ] );
- equals( ui.oldContent.size(), 1 );
+ equal( ui.oldContent.size(), 1 );
strictEqual( ui.oldContent[ 0 ], content[ 0 ] );
- equals( ui.newHeader.size(), 1 );
+ equal( ui.newHeader.size(), 1 );
strictEqual( ui.newHeader[ 0 ], headers[ 1 ] );
- equals( ui.newContent.size(), 1 );
+ equal( ui.newContent.size(), 1 );
strictEqual( ui.newContent[ 0 ], content[ 1 ] );
accordion_state( element, 1, 0, 0 );
});
element.one( "accordionbeforeactivate", function( event, ui ) {
ok( !( "originalEvent" in event ) );
- equals( ui.oldHeader.size(), 1 );
+ equal( ui.oldHeader.size(), 1 );
strictEqual( ui.oldHeader[ 0 ], headers[ 1 ] );
- equals( ui.oldContent.size(), 1 );
+ equal( ui.oldContent.size(), 1 );
strictEqual( ui.oldContent[ 0 ], content[ 1 ] );
- equals( ui.newHeader.size(), 0 );
- equals( ui.newContent.size(), 0 );
+ equal( ui.newHeader.size(), 0 );
+ equal( ui.newContent.size(), 0 );
accordion_state( element, 0, 1, 0 );
});
element.accordion( "option", "active", false );
element.one( "accordionbeforeactivate", function( event, ui ) {
ok( !( "originalEvent" in event ) );
- equals( ui.oldHeader.size(), 0 );
- equals( ui.oldContent.size(), 0 );
- equals( ui.newHeader.size(), 1 );
+ equal( ui.oldHeader.size(), 0 );
+ equal( ui.oldContent.size(), 0 );
+ equal( ui.newHeader.size(), 1 );
strictEqual( ui.newHeader[ 0 ], headers[ 2 ] );
- equals( ui.newContent.size(), 1 );
+ equal( ui.newContent.size(), 1 );
strictEqual( ui.newContent[ 0 ], content[ 2 ] );
event.preventDefault();
accordion_state( element, 0, 0, 0 );
var content = element.find( ".ui-accordion-content" );
element.one( "accordionactivate", function( event, ui ) {
- equals( ui.oldHeader.size(), 0 );
- equals( ui.oldContent.size(), 0 );
- equals( ui.newHeader.size(), 1 );
+ equal( ui.oldHeader.size(), 0 );
+ equal( ui.oldContent.size(), 0 );
+ equal( ui.newHeader.size(), 1 );
strictEqual( ui.newHeader[ 0 ], headers[ 0 ] );
- equals( ui.newContent.size(), 1 );
+ equal( ui.newContent.size(), 1 );
strictEqual( ui.newContent[ 0 ], content[ 0 ] );
});
element.accordion( "option", "active", 0 );
element.one( "accordionactivate", function( event, ui ) {
- equals( ui.oldHeader.size(), 1 );
+ equal( ui.oldHeader.size(), 1 );
strictEqual( ui.oldHeader[ 0 ], headers[ 0 ] );
- equals( ui.oldContent.size(), 1 );
+ equal( ui.oldContent.size(), 1 );
strictEqual( ui.oldContent[ 0 ], content[ 0 ] );
- equals( ui.newHeader.size(), 1 );
+ equal( ui.newHeader.size(), 1 );
strictEqual( ui.newHeader[ 0 ], headers[ 1 ] );
- equals( ui.newContent.size(), 1 );
+ equal( ui.newContent.size(), 1 );
strictEqual( ui.newContent[ 0 ], content[ 1 ] );
});
headers.eq( 1 ).click();
element.one( "accordionactivate", function( event, ui ) {
- equals( ui.oldHeader.size(), 1 );
+ equal( ui.oldHeader.size(), 1 );
strictEqual( ui.oldHeader[ 0 ], headers[ 1 ] );
- equals( ui.oldContent.size(), 1 );
+ equal( ui.oldContent.size(), 1 );
strictEqual( ui.oldContent[ 0 ], content[ 1 ] );
- equals( ui.newHeader.size(), 0 );
- equals( ui.newContent.size(), 0 );
+ equal( ui.newHeader.size(), 0 );
+ equal( ui.newContent.size(), 0 );
});
element.accordion( "option", "active", false );
test( "{ active: default }", function() {
var element = $( "#list1" ).accordion();
- equals( element.accordion( "option", "active" ), 0 );
+ equal( element.accordion( "option", "active" ), 0 );
accordion_state( element, 1, 0, 0 );
});
collapsible: true
});
accordion_state( element, 0, 0, 0 );
- equals( element.find( ".ui-accordion-header.ui-state-active" ).size(), 0, "no headers selected" );
- equals( element.accordion( "option", "active" ), false );
+ equal( element.find( ".ui-accordion-header.ui-state-active" ).size(), 0, "no headers selected" );
+ equal( element.accordion( "option", "active" ), false );
element.accordion( "option", "collapsible", false );
accordion_state( element, 1, 0, 0 );
- equals( element.accordion( "option", "active" ), 0 );
+ equal( element.accordion( "option", "active" ), 0 );
element.accordion( "destroy" );
element.accordion({
var element = $( "#list1" ).accordion({
active: 2
});
- equals( element.accordion( "option", "active" ), 2 );
+ equal( element.accordion( "option", "active" ), 2 );
accordion_state( element, 0, 0, 1 );
element.accordion( "option", "active", 0 );
- equals( element.accordion( "option", "active" ), 0 );
+ equal( element.accordion( "option", "active" ), 0 );
accordion_state( element, 1, 0, 0 );
element.find( ".ui-accordion-header" ).eq( 1 ).click();
- equals( element.accordion( "option", "active" ), 1 );
+ equal( element.accordion( "option", "active" ), 1 );
accordion_state( element, 0, 1, 0 );
element.accordion( "option", "active", 10 );
- equals( element.accordion( "option", "active" ), 1 );
+ equal( element.accordion( "option", "active" ), 1 );
accordion_state( element, 0, 1, 0 );
});
var element = $( "#list1" ).accordion({
active: -1
});
- equals( element.accordion( "option", "active" ), 2 );
+ equal( element.accordion( "option", "active" ), 2 );
accordion_state( element, 0, 0, 1 );
element.accordion( "option", "active", -2 );
- equals( element.accordion( "option", "active" ), 1 );
+ equal( element.accordion( "option", "active" ), 1 );
accordion_state( element, 0, 1, 0 );
element.accordion( "option", "active", -10 );
- equals( element.accordion( "option", "active" ), 1 );
+ equal( element.accordion( "option", "active" ), 1 );
accordion_state( element, 0, 1, 0 );
element.accordion( "option", "active", -3 );
- equals( element.accordion( "option", "active" ), 0 );
+ equal( element.accordion( "option", "active" ), 0 );
accordion_state( element, 1, 0, 0 );
});
}
accordion_state( element, 0, 1, 0 );
element.find( ".ui-accordion-header" ).eq( 1 ).click();
- equals( element.accordion( "option", "active" ), false );
+ equal( element.accordion( "option", "active" ), false );
accordion_state( element, 0, 0, 0 );
});
test( "{ icons: false }", function() {
var element = $( "#list1" );
function icons( on ) {
- same( element.find( "span.ui-icon").length, on ? 3 : 0 );
- same( element.hasClass( "ui-accordion-icons" ), on );
+ deepEqual( element.find( "span.ui-icon").length, on ? 3 : 0 );
+ deepEqual( element.hasClass( "ui-accordion-icons" ), on );
}
element.accordion();
icons( true );