2015-04-06 16:56:07 +00:00
|
|
|
define( [
|
|
|
|
"jquery",
|
2015-07-15 02:01:41 +00:00
|
|
|
"ui/effects/effect-scale"
|
2015-04-06 16:56:07 +00:00
|
|
|
], function( $ ) {
|
|
|
|
|
2011-06-14 20:11:43 +00:00
|
|
|
module( "effect.scale: Scale" );
|
|
|
|
|
|
|
|
function run( position, v, h, vo, ho ) {
|
|
|
|
var desc = "End Position Correct: " + position + " (" + v + "," + h + ") - origin: (" + vo + "," + ho + ")";
|
2015-03-31 20:52:28 +00:00
|
|
|
asyncTest( desc, function( assert ) {
|
2012-06-27 15:32:48 +00:00
|
|
|
expect( 2 );
|
2012-04-19 13:39:21 +00:00
|
|
|
function complete() {
|
2015-03-31 20:52:28 +00:00
|
|
|
assert.close( parseInt( test.css( h ), 10 ), target[ h ], 1, "Horizontal Position Correct " + desc );
|
|
|
|
assert.close( parseInt( test.css( v ), 10 ), target[ v ], 1, "Vertical Position Correct " + desc );
|
2012-04-19 13:39:21 +00:00
|
|
|
start();
|
|
|
|
}
|
2011-06-14 20:11:43 +00:00
|
|
|
var test = $( ".testScale" ),
|
|
|
|
css = {
|
|
|
|
position: position
|
|
|
|
},
|
|
|
|
effect = {
|
|
|
|
effect: "scale",
|
|
|
|
mode: "effect",
|
|
|
|
percent: 200,
|
|
|
|
origin: [ vo, ho ],
|
|
|
|
complete: complete,
|
|
|
|
duration: 1
|
|
|
|
},
|
|
|
|
target = {},
|
|
|
|
relative = position === "relative";
|
|
|
|
|
|
|
|
css[ h ] = 33;
|
|
|
|
css[ v ] = 33;
|
2012-04-19 13:39:21 +00:00
|
|
|
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" ) {
|
2011-06-14 20:11:43 +00:00
|
|
|
target[ h ] += 70;
|
|
|
|
}
|
2012-04-19 13:39:21 +00:00
|
|
|
if ( relative && v === "bottom" ) {
|
2011-06-14 20:11:43 +00:00
|
|
|
target[ v ] += 70;
|
|
|
|
}
|
|
|
|
test.css( css );
|
|
|
|
test.effect( effect );
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
function suite( position ) {
|
|
|
|
run( position, "top", "left", "top", "left" );
|
|
|
|
run( position, "top", "left", "middle", "center" );
|
|
|
|
run( position, "top", "left", "bottom", "right" );
|
2011-10-13 21:06:19 +00:00
|
|
|
/* Firefox is currently not capable of supporting detection of bottom and right....
|
2011-06-14 20:11:43 +00:00
|
|
|
run( position, "bottom", "right", "top", "left" );
|
|
|
|
run( position, "bottom", "right", "middle", "center" );
|
|
|
|
run( position, "bottom", "right", "bottom", "right" );
|
2011-10-13 21:06:19 +00:00
|
|
|
*/
|
2011-06-14 20:11:43 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
$(function() {
|
|
|
|
suite( "absolute" );
|
|
|
|
suite( "relative" );
|
2012-06-16 12:19:41 +00:00
|
|
|
var fixedElem = $( "<div>" )
|
|
|
|
.css({
|
|
|
|
position: "fixed",
|
|
|
|
top: 10
|
|
|
|
})
|
|
|
|
.appendTo( "body" );
|
|
|
|
if ( fixedElem.offset().top === 10 ) {
|
2011-06-14 20:11:43 +00:00
|
|
|
suite( "fixed" );
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2015-04-06 16:56:07 +00:00
|
|
|
} );
|