menu_click: true,
menu_log: true,
module: true,
+ notEqual: true,
ok: true,
QUnit: true,
spinner_simulateKeyDownUp: true,
var test = $("div.animateClass"),
style = test[0].style,
orig = style.cssText;
-
+
expect( 2 );
test.addClass( "testChangeBackground", duration );
asyncTest( "animateClass: css and class changes during animation are not lost (#7106)", function() {
var test = $( "div.ticket7106" );
- // add a class and change a style property after starting an animated class
- test.addClass( "animate", minDuration, animationComplete )
- .addClass( "testClass" )
- .height( 100 );
-
// ensure the class stays and that the css property stays
function animationComplete() {
ok( test.hasClass( "testClass" ), "class change during animateClass was not lost" );
equal( test.height(), 100, "css change during animateClass was not lost" );
start();
}
+
+ // add a class and change a style property after starting an animated class
+ test.addClass( "animate", minDuration, animationComplete )
+ .addClass( "testClass" )
+ .height( 100 );
});
}
module( "effect."+effect );
asyncTest( "show/hide", function() {
- var hidden = $( "div.hidden" );
expect( 8 );
-
- var count = 0,
+ var hidden = $( "div.hidden" ),
+ count = 0,
test = 0;
function queueTest( fn ) {
function run( position, v, h, vo, ho ) {
var desc = "End Position Correct: " + position + " (" + v + "," + h + ") - origin: (" + vo + "," + ho + ")";
asyncTest( desc, function() {
+ function complete() {
+ equal( parseInt( test.css( h ), 10 ), target[ h ], "Horizontal Position Correct " + desc );
+ equal( parseInt( test.css( v ), 10 ), target[ v ], "Vertical Position Correct " + desc );
+ start();
+ }
var test = $( ".testScale" ),
css = {
position: position
css[ h ] = 33;
css[ v ] = 33;
- target[ h ] = h === ho ? css[ h ] : ho == "center" ? css[ h ] - 35 : css[ h ] - 70;
- target[ v ] = v === vo ? css[ v ] : vo == "middle" ? css[ v ] - 35 : css[ v ] - 70;
- if ( relative && h == "right" ) {
+ target[ h ] = h === ho ? css[ h ] : ho === "center" ? css[ h ] - 35 : css[ h ] - 70;
+ target[ v ] = v === vo ? css[ v ] : vo === "middle" ? css[ v ] - 35 : css[ v ] - 70;
+ if ( relative && h === "right" ) {
target[ h ] += 70;
}
- if ( relative && v == "bottom" ) {
+ if ( relative && v === "bottom" ) {
target[ v ] += 70;
}
test.css( css );
test.effect( effect );
-
- function complete() {
- equal( parseInt( test.css( h ), 10 ), target[ h ], "Horizontal Position Correct " + desc );
- equal( parseInt( test.css( v ), 10 ), target[ v ], "Vertical Position Correct " + desc );
- start();
- }
});
}
test("accessibility", function () {
expect(5);
- var menu = $('#menu1').menu();
- var item0 = $("li:eq(0) a");
+ var item,
+ menu = $('#menu1').menu(),
+ item0 = $("li:eq(0) a");
ok( menu.hasClass("ui-menu ui-widget ui-widget-content ui-corner-all"), "menu class");
equal( menu.attr("role"), "menu", "main role");
ok( !menu.attr("aria-activedescendant"), "aria attribute not yet active");
- var item = menu.find( "li:first" ).find( "a" ).attr( "id", "xid" ).end();
+ item = menu.find( "li:first" ).find( "a" ).attr( "id", "xid" ).end();
menu.menu( "focus", $.Event(), item );
equal( menu.attr("aria-activedescendant"), "xid", "aria attribute, id from dom");
- var item = menu.find( "li:last" );
+ item = menu.find( "li:last" );
menu.menu( "focus", $.Event(), item );
equal( menu.attr("aria-activedescendant"), "menu1-4", "aria attribute, generated id");
});
expect( 4 );
var $menu = $( "#menu2" ).menu();
- $menu.find( "li:nth-child(7)" ).trigger( "mouseover" );
- setTimeout( menumouseleave1, 350 );
-
function menumouseleave1() {
equal( $menu.find( "ul[aria-expanded='true']" ).length, 1, "first submenu expanded" );
$menu.find( "li:nth-child(7) li:first" ).trigger( "mouseover" );
equal( $menu.find( "ul[aria-expanded='true']" ).length, 0, "first submenu collapsed" );
start();
}
+
+ $menu.find( "li:nth-child(7)" ).trigger( "mouseover" );
+ setTimeout( menumouseleave1, 350 );
});
asyncTest( "handle submenu auto collapse: mouseleave", function() {
expect( 4 );
var $menu = $( "#menu5" ).menu( { menus: "div" } );
- $menu.find( ":nth-child(7)" ).trigger( "mouseover" );
- setTimeout( menumouseleave1, 350 );
-
function menumouseleave1() {
equal( $menu.find( "div[aria-expanded='true']" ).length, 1, "first submenu expanded" );
$menu.find( ":nth-child(7)" ).find( "div" ).eq( 0 ).children().eq( 0 ).trigger( "mouseover" );
equal( $menu.find( "div[aria-expanded='true']" ).length, 0, "first submenu collapsed" );
start();
}
+
+ $menu.find( ":nth-child(7)" ).trigger( "mouseover" );
+ setTimeout( menumouseleave1, 350 );
+
});
});
test( "multiple elements", function() {
- var elements = $( "#el1, #el2" );
- var result = elements.position({
- my: "left top",
- at: "left bottom",
- of: "#parent",
- collision: "none"
- });
+ var elements = $( "#el1, #el2" ),
+ result = elements.position({
+ my: "left top",
+ at: "left bottom",
+ of: "#parent",
+ collision: "none"
+ }),
+ expected = { top: 10, left: 4 };
deepEqual( result, elements );
- var expected = { top: 10, left: 4 };
elements.each(function() {
deepEqual( $( this ).offset(), expected );
});
});
test( "positions", function() {
- var definitions = [];
- var offsets = {
- left: 0,
- center: 3,
- right: 6,
- top: 0,
- bottom: 6
- };
- var start = { left: 4, top: 4 };
+ var definitions = [],
+ offsets = {
+ left: 0,
+ center: 3,
+ right: 6,
+ top: 0,
+ bottom: 6
+ },
+ start = { left: 4, top: 4 },
+ el = $( "#el1" );
$.each( [ 0, 1 ], function( my ) {
$.each( [ "top", "center", "bottom" ], function( vindex, vertical ) {
$.each( [ "left", "center", "right" ], function( hindex, horizontal ) {
});
});
});
- var el = $( "#el1" );
$.each( definitions, function( index, definition ) {
el.position({
my: definition.my,
deepEqual( elem.hasClass( 'ui-flipped-left' ), false, 'Has ui-flipped-left class' );
- elem.position( {
+ elem.position({
my: "right center",
of: window,
collision: "flip",
at: "left center"
- })
+ });
deepEqual( elem.hasClass( 'ui-flipped-left' ), false, 'Removed ui-flipped-left class' );
});
});
test( "multiple elements", function() {
- var elements = $( "#el1, #el2" );
- var result = elements.position({
- my: "left top",
- at: "left bottom",
- of: "#parent",
- collision: "none",
- within: $("#within-container")
- });
+ var elements = $( "#el1, #el2" ),
+ result = elements.position({
+ my: "left top",
+ at: "left bottom",
+ of: "#parent",
+ collision: "none",
+ within: $("#within-container")
+ }),
+ expected = { top: addTop + 10, left: addLeft + 4 };
deepEqual( result, elements );
- var expected = { top: addTop + 10, left: addLeft + 4 };
elements.each(function() {
deepEqual( $( this ).addOffsets(), expected );
});
});
test( "positions", function() {
- var definitions = [];
- var offsets = {
- left: 0,
- center: 3,
- right: 6,
- top: 0,
- bottom: 6
- };
- var start = { left: 4, top: 4 };
+ var definitions = [],
+ offsets = {
+ left: 0,
+ center: 3,
+ right: 6,
+ top: 0,
+ bottom: 6
+ },
+ start = { left: 4, top: 4 },
+ el = $( "#el1" );
$.each( [ 0, 1 ], function( my ) {
$.each( [ "top", "center", "bottom" ], function( vindex, vertical ) {
$.each( [ "left", "center", "right" ], function( hindex, horizontal ) {
});
});
});
- var el = $( "#el1" );
$.each( definitions, function( index, definition ) {
el.position({
my: definition.my,
});
test( "of", function() {
- var within = $("#within-container");
+ var event,
+ within = $( "#within-container" );
$( "#elx" ).position({
my: "left top",
});
deepEqual( $( "#elx" ).addOffsets(), { top: addTop + 40, left: addLeft + 40 }, "DOM element" );
- var event = $.extend( $.Event( "someEvent" ), { pageX: 200, pageY: 300 } );
+ event = $.extend( $.Event( "someEvent" ), { pageX: 200, pageY: 300 } );
$( "#elx" ).position({
my: "left top",
at: "left top",
test( "using", function() {
expect( 6 );
- var within = $("#within-container");
-
- var count = 0,
+ var within = $( "#within-container" ),
+ count = 0,
elems = $( "#el1, #el2" ),
expectedPosition = { top: addTop + 40, left: addLeft + 40 },
originalPosition = elems.position({
});
function collisionTest( config, result, msg ) {
- var within = $("#within-container");
-
- var elem = $( "#elx" ).position( $.extend({
- my: "left top",
- at: "right bottom",
- of: "#parentx",
- within: within
- }, config ) );
+ var within = $( "#within-container" ),
+ elem = $( "#elx" ).position( $.extend({
+ my: "left top",
+ at: "right bottom",
+ of: "#parentx",
+ within: within
+ }, config ) );
deepEqual( elem.addOffsets(), result, msg );
}
});
test( "addClass: flipped left", function() {
- var within = $("#within-container");
-
- var elem = $( "#elx" ).position( {
- my: "left center",
- of: within[0],
- within: within,
- collision: "flip",
- at: "right center"
- });
+ var within = $("#within-container"),
+ elem = $( "#elx" ).position( {
+ my: "left center",
+ of: within[0],
+ within: within,
+ collision: "flip",
+ at: "right center"
+ });
deepEqual( elem.hasClass( 'ui-flipped-left' ), false, 'Has ui-flipped-left class' );
- elem.position( {
+ elem.position({
my: "right center",
of: within[0],
within: within,
collision: "flip",
at: "left center"
- })
+ });
deepEqual( elem.hasClass( 'ui-flipped-left' ), false, 'Removed ui-flipped-left class' );
});
test( "addClass: flipped top", function() {
- var within = $("#within-container");
-
- var elem = $( "#elx" ).position( {
- my: "left top",
- of: within[0],
- within: within,
- collision: "flip",
- at: "right bottom"
- });
+ var within = $("#within-container"),
+ elem = $( "#elx" ).position( {
+ my: "left top",
+ of: within[0],
+ within: within,
+ collision: "flip",
+ at: "right bottom"
+ });
deepEqual( elem.hasClass( 'ui-flipped-top' ), false, 'Has ui-flipped-top class' );
});
test( "addClass: flipped right", function() {
- var within = $("#within-container");
-
- var elem = $( "#elx" ).position( {
- my: "right center",
- of: within[0],
- within: within,
- collision: "flip",
- at: "left center"
- });
+ var within = $("#within-container"),
+ elem = $( "#elx" ).position( {
+ my: "right center",
+ of: within[0],
+ within: within,
+ collision: "flip",
+ at: "left center"
+ });
deepEqual( elem.hasClass( 'ui-flipped-right' ), false, 'Has ui-flipped-right class' );
});
test( "addClass: flipped bottom", function() {
- var within = $("#within-container");
-
- var elem = $( "#elx" ).position( {
- my: "left bottom",
- of: window,
- collision: "flip",
- at: "right top"
- });
+ var within = $("#within-container"),
+ elem = $( "#elx" ).position( {
+ my: "left bottom",
+ of: window,
+ collision: "flip",
+ at: "right top"
+ });
deepEqual( elem.hasClass( 'ui-flipped-bottom' ), false, 'Has ui-flipped-bottom class' );