Skip to content
Permalink
Browse files

Tabs tests: Work around IE quirks.

  • Loading branch information
scottgonzalez committed May 4, 2012
1 parent 96510ea commit dec5b4889850923b366ef54a40d568f28d5dd8d2
Showing with 15 additions and 3 deletions.
  1. +15 −3 tests/unit/tabs/tabs_deprecated.js
@@ -394,10 +394,15 @@ test( "select", function() {
module( "tabs (deprecated): methods" );

test( "add", function() {
expect( 27 );
expect( 28 );

var tab, anchor,
element = $( "#tabs1" ).tabs();

function stripLeadingSlash( str ) {
return str.substr( str.charAt( 0 ) === "/" ? 1 : 0 );
}

state( element, 1, 0, 0 );

// add without index
@@ -411,7 +416,8 @@ test( "add", function() {
tab = element.find( ".ui-tabs-nav li" ).last();
anchor = tab.find( "a" );
equal( tab.text(), "New", "label" );
equal( anchor.attr( "href" ), "#new", "href" );
equal( stripLeadingSlash( anchor[0].pathname ), stripLeadingSlash( location.pathname ), "href pathname" );
equal( anchor[0].hash, "#new", "href hash" );
equal( anchor.attr( "aria-controls" ), "new", "aria-controls" );
ok( !tab.hasClass( "ui-state-hover" ), "not hovered" );
anchor.simulate( "mouseover" );
@@ -430,7 +436,9 @@ test( "add", function() {
tab = element.find( ".ui-tabs-nav li" ).eq( 1 );
anchor = tab.find( "a" );
equal( tab.text(), "New Remote", "label" );
equal( anchor.attr( "href" ), "data/test.html", "href" );
equal( stripLeadingSlash( stripLeadingSlash(
anchor[0].pathname.replace( stripLeadingSlash( location.pathname ).split( "/" ).slice( 0, -1 ).join( "/" ), "" )
) ), "data/test.html", "href" );
ok( /^ui-tabs-\d+$/.test( anchor.attr( "aria-controls" ) ), "aria controls" );
ok( !tab.hasClass( "ui-state-hover" ), "not hovered" );
anchor.simulate( "mouseover" );
@@ -573,6 +581,10 @@ asyncTest( "abort", function() {
start();
});
});
// prevent IE from caching the request, so that it won't resolve before we call abort
element.find( ".ui-tabs-nav li:eq(2) a" ).attr( "href", function( href ) {
return href + "?" + (+ new Date());
});
element.tabs( "option", "active", 2 );
element.tabs( "abort" );
});

0 comments on commit dec5b48

Please sign in to comment.
You can’t perform that action at this time.