2015-04-06 17:08:27 +00:00
|
|
|
define( [
|
2016-04-06 13:05:47 +00:00
|
|
|
"qunit",
|
2015-04-06 17:08:27 +00:00
|
|
|
"jquery",
|
|
|
|
"lib/common",
|
|
|
|
"ui/position"
|
2016-04-06 13:05:47 +00:00
|
|
|
], function( QUnit, $, common ) {
|
2011-03-22 17:12:03 +00:00
|
|
|
|
2012-04-23 19:52:06 +00:00
|
|
|
var win = $( window ),
|
|
|
|
scrollTopSupport = function() {
|
|
|
|
var support = win.scrollTop( 1 ).scrollTop() === 1;
|
|
|
|
win.scrollTop( 0 );
|
|
|
|
scrollTopSupport = function() {
|
|
|
|
return support;
|
|
|
|
};
|
|
|
|
return support;
|
|
|
|
};
|
|
|
|
|
2016-04-06 13:05:47 +00:00
|
|
|
QUnit.module( "position", {
|
|
|
|
beforeEach: function() {
|
2012-04-23 19:52:06 +00:00
|
|
|
win.scrollTop( 0 ).scrollLeft( 0 );
|
|
|
|
}
|
2015-08-24 13:33:22 +00:00
|
|
|
} );
|
2011-03-22 17:12:03 +00:00
|
|
|
|
2015-04-06 17:08:27 +00:00
|
|
|
common.testJshint( "position" );
|
2012-04-30 00:22:31 +00:00
|
|
|
|
2016-04-06 13:05:47 +00:00
|
|
|
QUnit.test( "my, at, of", function( assert ) {
|
|
|
|
assert.expect( 4 );
|
2012-04-23 19:52:06 +00:00
|
|
|
|
2015-08-24 13:33:22 +00:00
|
|
|
$( "#elx" ).position( {
|
2011-03-22 17:12:03 +00:00
|
|
|
my: "left top",
|
|
|
|
at: "left top",
|
|
|
|
of: "#parentx",
|
|
|
|
collision: "none"
|
2015-08-24 13:33:22 +00:00
|
|
|
} );
|
2016-04-06 13:05:47 +00:00
|
|
|
assert.deepEqual( $( "#elx" ).offset(), { top: 40, left: 40 }, "left top, left top" );
|
2010-01-07 03:19:50 +00:00
|
|
|
|
2015-08-24 13:33:22 +00:00
|
|
|
$( "#elx" ).position( {
|
2011-03-22 17:12:03 +00:00
|
|
|
my: "left top",
|
|
|
|
at: "left bottom",
|
|
|
|
of: "#parentx",
|
|
|
|
collision: "none"
|
2015-08-24 13:33:22 +00:00
|
|
|
} );
|
2016-04-06 13:05:47 +00:00
|
|
|
assert.deepEqual( $( "#elx" ).offset(), { top: 60, left: 40 }, "left top, left bottom" );
|
2010-01-07 03:19:50 +00:00
|
|
|
|
2015-08-24 13:33:22 +00:00
|
|
|
$( "#elx" ).position( {
|
2011-03-22 17:12:03 +00:00
|
|
|
my: "left",
|
|
|
|
at: "bottom",
|
|
|
|
of: "#parentx",
|
|
|
|
collision: "none"
|
2015-08-24 13:33:22 +00:00
|
|
|
} );
|
2016-04-06 13:05:47 +00:00
|
|
|
assert.deepEqual( $( "#elx" ).offset(), { top: 55, left: 50 }, "left, bottom" );
|
2010-01-07 03:19:50 +00:00
|
|
|
|
2015-08-24 13:33:22 +00:00
|
|
|
$( "#elx" ).position( {
|
2011-03-22 17:12:03 +00:00
|
|
|
my: "left foo",
|
|
|
|
at: "bar baz",
|
|
|
|
of: "#parentx",
|
|
|
|
collision: "none"
|
2015-08-24 13:33:22 +00:00
|
|
|
} );
|
2016-04-06 13:05:47 +00:00
|
|
|
assert.deepEqual( $( "#elx" ).offset(), { top: 45, left: 50 }, "left foo, bar baz" );
|
2015-08-24 13:33:22 +00:00
|
|
|
} );
|
2010-01-07 03:19:50 +00:00
|
|
|
|
2016-04-06 13:05:47 +00:00
|
|
|
QUnit.test( "multiple elements", function( assert ) {
|
|
|
|
assert.expect( 3 );
|
2012-04-23 19:52:06 +00:00
|
|
|
|
2012-04-19 13:39:21 +00:00
|
|
|
var elements = $( "#el1, #el2" ),
|
2015-08-24 13:33:22 +00:00
|
|
|
result = elements.position( {
|
2012-04-19 13:39:21 +00:00
|
|
|
my: "left top",
|
|
|
|
at: "left bottom",
|
|
|
|
of: "#parent",
|
|
|
|
collision: "none"
|
2015-08-24 13:33:22 +00:00
|
|
|
} ),
|
2012-04-19 13:39:21 +00:00
|
|
|
expected = { top: 10, left: 4 };
|
2010-01-07 03:19:50 +00:00
|
|
|
|
2016-04-06 13:05:47 +00:00
|
|
|
assert.deepEqual( result, elements );
|
2015-08-24 13:33:22 +00:00
|
|
|
elements.each( function() {
|
2016-04-06 13:05:47 +00:00
|
|
|
assert.deepEqual( $( this ).offset(), expected );
|
2015-08-24 13:33:22 +00:00
|
|
|
} );
|
|
|
|
} );
|
2010-01-07 03:19:50 +00:00
|
|
|
|
2016-04-06 13:05:47 +00:00
|
|
|
QUnit.test( "positions", function( assert ) {
|
|
|
|
assert.expect( 18 );
|
2012-04-23 19:52:06 +00:00
|
|
|
|
|
|
|
var offsets = {
|
2012-04-19 13:39:21 +00:00
|
|
|
left: 0,
|
|
|
|
center: 3,
|
|
|
|
right: 6,
|
|
|
|
top: 0,
|
|
|
|
bottom: 6
|
|
|
|
},
|
|
|
|
start = { left: 4, top: 4 },
|
|
|
|
el = $( "#el1" );
|
2012-04-23 19:52:06 +00:00
|
|
|
|
2011-03-22 17:12:03 +00:00
|
|
|
$.each( [ 0, 1 ], function( my ) {
|
|
|
|
$.each( [ "top", "center", "bottom" ], function( vindex, vertical ) {
|
|
|
|
$.each( [ "left", "center", "right" ], function( hindex, horizontal ) {
|
2012-04-23 19:52:06 +00:00
|
|
|
var _my = my ? horizontal + " " + vertical : "left top",
|
|
|
|
_at = !my ? horizontal + " " + vertical : "left top";
|
2015-08-24 13:33:22 +00:00
|
|
|
el.position( {
|
2012-04-23 19:52:06 +00:00
|
|
|
my: _my,
|
|
|
|
at: _at,
|
|
|
|
of: "#parent",
|
|
|
|
collision: "none"
|
2015-08-24 13:33:22 +00:00
|
|
|
} );
|
2016-04-06 13:05:47 +00:00
|
|
|
assert.deepEqual( el.offset(), {
|
2015-08-24 13:33:22 +00:00
|
|
|
top: start.top + offsets[ vertical ] * ( my ? -1 : 1 ),
|
|
|
|
left: start.left + offsets[ horizontal ] * ( my ? -1 : 1 )
|
|
|
|
}, "Position via " + QUnit.jsDump.parse( { my: _my, at: _at } ) );
|
|
|
|
} );
|
|
|
|
} );
|
|
|
|
} );
|
|
|
|
} );
|
2010-01-07 03:19:50 +00:00
|
|
|
|
2016-04-06 13:05:47 +00:00
|
|
|
QUnit.test( "of", function( assert ) {
|
|
|
|
assert.expect( 9 + ( scrollTopSupport() ? 1 : 0 ) );
|
2012-04-23 19:52:06 +00:00
|
|
|
|
|
|
|
var event;
|
|
|
|
|
2015-08-24 13:33:22 +00:00
|
|
|
$( "#elx" ).position( {
|
2011-03-22 17:12:03 +00:00
|
|
|
my: "left top",
|
|
|
|
at: "left top",
|
|
|
|
of: "#parentx",
|
|
|
|
collision: "none"
|
2015-08-24 13:33:22 +00:00
|
|
|
} );
|
2016-04-06 13:05:47 +00:00
|
|
|
assert.deepEqual( $( "#elx" ).offset(), { top: 40, left: 40 }, "selector" );
|
2011-03-22 17:12:03 +00:00
|
|
|
|
2015-08-24 13:33:22 +00:00
|
|
|
$( "#elx" ).position( {
|
2011-03-22 17:12:03 +00:00
|
|
|
my: "left top",
|
|
|
|
at: "left bottom",
|
2015-08-24 13:33:22 +00:00
|
|
|
of: $( "#parentx" ),
|
2011-03-22 17:12:03 +00:00
|
|
|
collision: "none"
|
2015-08-24 13:33:22 +00:00
|
|
|
} );
|
2016-04-06 13:05:47 +00:00
|
|
|
assert.deepEqual( $( "#elx" ).offset(), { top: 60, left: 40 }, "jQuery object" );
|
2011-03-22 17:12:03 +00:00
|
|
|
|
2015-08-24 13:33:22 +00:00
|
|
|
$( "#elx" ).position( {
|
2011-03-22 17:12:03 +00:00
|
|
|
my: "left top",
|
|
|
|
at: "left top",
|
|
|
|
of: $( "#parentx" )[ 0 ],
|
|
|
|
collision: "none"
|
2015-08-24 13:33:22 +00:00
|
|
|
} );
|
2016-04-06 13:05:47 +00:00
|
|
|
assert.deepEqual( $( "#elx" ).offset(), { top: 40, left: 40 }, "DOM element" );
|
2011-03-22 17:12:03 +00:00
|
|
|
|
2015-08-24 13:33:22 +00:00
|
|
|
$( "#elx" ).position( {
|
2011-03-22 17:12:03 +00:00
|
|
|
my: "right bottom",
|
|
|
|
at: "right bottom",
|
2010-01-07 03:19:50 +00:00
|
|
|
of: document,
|
2011-03-22 17:12:03 +00:00
|
|
|
collision: "none"
|
2015-08-24 13:33:22 +00:00
|
|
|
} );
|
2016-04-06 13:05:47 +00:00
|
|
|
assert.deepEqual( $( "#elx" ).offset(), {
|
2011-03-22 17:12:03 +00:00
|
|
|
top: $( document ).height() - 10,
|
|
|
|
left: $( document ).width() - 10
|
|
|
|
}, "document" );
|
|
|
|
|
2015-08-24 13:33:22 +00:00
|
|
|
$( "#elx" ).position( {
|
2011-03-22 17:12:03 +00:00
|
|
|
my: "right bottom",
|
|
|
|
at: "right bottom",
|
|
|
|
of: $( document ),
|
|
|
|
collision: "none"
|
2015-08-24 13:33:22 +00:00
|
|
|
} );
|
2016-04-06 13:05:47 +00:00
|
|
|
assert.deepEqual( $( "#elx" ).offset(), {
|
2011-03-22 17:12:03 +00:00
|
|
|
top: $( document ).height() - 10,
|
|
|
|
left: $( document ).width() - 10
|
|
|
|
}, "document as jQuery object" );
|
|
|
|
|
2012-04-23 19:52:06 +00:00
|
|
|
win.scrollTop( 0 );
|
2011-03-22 17:12:03 +00:00
|
|
|
|
2015-08-24 13:33:22 +00:00
|
|
|
$( "#elx" ).position( {
|
2011-03-22 17:12:03 +00:00
|
|
|
my: "right bottom",
|
|
|
|
at: "right bottom",
|
2010-01-07 03:19:50 +00:00
|
|
|
of: window,
|
2011-03-22 17:12:03 +00:00
|
|
|
collision: "none"
|
2015-08-24 13:33:22 +00:00
|
|
|
} );
|
2016-04-06 13:05:47 +00:00
|
|
|
assert.deepEqual( $( "#elx" ).offset(), {
|
2012-04-23 19:52:06 +00:00
|
|
|
top: win.height() - 10,
|
|
|
|
left: win.width() - 10
|
2011-03-22 17:12:03 +00:00
|
|
|
}, "window" );
|
|
|
|
|
2015-08-24 13:33:22 +00:00
|
|
|
$( "#elx" ).position( {
|
2011-03-22 17:12:03 +00:00
|
|
|
my: "right bottom",
|
|
|
|
at: "right bottom",
|
2012-04-23 19:52:06 +00:00
|
|
|
of: win,
|
2011-03-22 17:12:03 +00:00
|
|
|
collision: "none"
|
2015-08-24 13:33:22 +00:00
|
|
|
} );
|
2016-04-06 13:05:47 +00:00
|
|
|
assert.deepEqual( $( "#elx" ).offset(), {
|
2012-04-23 19:52:06 +00:00
|
|
|
top: win.height() - 10,
|
|
|
|
left: win.width() - 10
|
2011-03-22 17:12:03 +00:00
|
|
|
}, "window as jQuery object" );
|
|
|
|
|
2011-05-03 08:38:17 +00:00
|
|
|
if ( scrollTopSupport() ) {
|
2012-04-23 19:52:06 +00:00
|
|
|
win.scrollTop( 500 ).scrollLeft( 200 );
|
2015-08-24 13:33:22 +00:00
|
|
|
$( "#elx" ).position( {
|
2011-03-22 17:12:03 +00:00
|
|
|
my: "right bottom",
|
|
|
|
at: "right bottom",
|
2011-02-26 10:23:37 +00:00
|
|
|
of: window,
|
2011-03-22 17:12:03 +00:00
|
|
|
collision: "none"
|
2015-08-24 13:33:22 +00:00
|
|
|
} );
|
2016-04-06 13:05:47 +00:00
|
|
|
assert.deepEqual( $( "#elx" ).offset(), {
|
2012-04-23 19:52:06 +00:00
|
|
|
top: win.height() + 500 - 10,
|
|
|
|
left: win.width() + 200 - 10
|
2011-03-22 17:12:03 +00:00
|
|
|
}, "window, scrolled" );
|
2012-04-23 19:52:06 +00:00
|
|
|
win.scrollTop( 0 ).scrollLeft( 0 );
|
2011-02-26 10:23:37 +00:00
|
|
|
}
|
2011-03-22 17:12:03 +00:00
|
|
|
|
2012-04-23 19:52:06 +00:00
|
|
|
event = $.extend( $.Event( "someEvent" ), { pageX: 200, pageY: 300 } );
|
2015-08-24 13:33:22 +00:00
|
|
|
$( "#elx" ).position( {
|
2011-03-22 17:12:03 +00:00
|
|
|
my: "left top",
|
|
|
|
at: "left top",
|
2010-01-07 03:19:50 +00:00
|
|
|
of: event,
|
2011-03-22 17:12:03 +00:00
|
|
|
collision: "none"
|
2015-08-24 13:33:22 +00:00
|
|
|
} );
|
2016-04-06 13:05:47 +00:00
|
|
|
assert.deepEqual( $( "#elx" ).offset(), {
|
2010-01-07 03:19:50 +00:00
|
|
|
top: 300,
|
|
|
|
left: 200
|
2011-03-22 17:12:03 +00:00
|
|
|
}, "event - left top, left top" );
|
|
|
|
|
|
|
|
event = $.extend( $.Event( "someEvent" ), { pageX: 400, pageY: 600 } );
|
2015-08-24 13:33:22 +00:00
|
|
|
$( "#elx" ).position( {
|
2011-03-22 17:12:03 +00:00
|
|
|
my: "left top",
|
|
|
|
at: "right bottom",
|
2010-01-07 03:19:50 +00:00
|
|
|
of: event,
|
2011-03-22 17:12:03 +00:00
|
|
|
collision: "none"
|
2015-08-24 13:33:22 +00:00
|
|
|
} );
|
2016-04-06 13:05:47 +00:00
|
|
|
assert.deepEqual( $( "#elx" ).offset(), {
|
2010-01-07 03:19:50 +00:00
|
|
|
top: 600,
|
|
|
|
left: 400
|
2011-03-22 17:12:03 +00:00
|
|
|
}, "event - left top, right bottom" );
|
2015-08-24 13:33:22 +00:00
|
|
|
} );
|
2010-01-07 03:19:50 +00:00
|
|
|
|
2016-04-06 13:05:47 +00:00
|
|
|
QUnit.test( "offsets", function( assert ) {
|
|
|
|
assert.expect( 9 );
|
2013-03-31 16:28:40 +00:00
|
|
|
|
|
|
|
var offset;
|
2012-04-23 19:52:06 +00:00
|
|
|
|
2015-08-24 13:33:22 +00:00
|
|
|
$( "#elx" ).position( {
|
2011-03-22 17:12:03 +00:00
|
|
|
my: "left top",
|
|
|
|
at: "left+10 bottom+10",
|
|
|
|
of: "#parentx",
|
|
|
|
collision: "none"
|
2015-08-24 13:33:22 +00:00
|
|
|
} );
|
2016-04-06 13:05:47 +00:00
|
|
|
assert.deepEqual( $( "#elx" ).offset(), { top: 70, left: 50 }, "offsets in at" );
|
2011-03-22 17:12:03 +00:00
|
|
|
|
2015-08-24 13:33:22 +00:00
|
|
|
$( "#elx" ).position( {
|
2011-03-22 17:12:03 +00:00
|
|
|
my: "left+10 top-10",
|
|
|
|
at: "left bottom",
|
|
|
|
of: "#parentx",
|
|
|
|
collision: "none"
|
2015-08-24 13:33:22 +00:00
|
|
|
} );
|
2016-04-06 13:05:47 +00:00
|
|
|
assert.deepEqual( $( "#elx" ).offset(), { top: 50, left: 50 }, "offsets in my" );
|
2011-03-22 16:25:25 +00:00
|
|
|
|
2015-08-24 13:33:22 +00:00
|
|
|
$( "#elx" ).position( {
|
2011-03-22 17:12:03 +00:00
|
|
|
my: "left top",
|
|
|
|
at: "left+50% bottom-10%",
|
|
|
|
of: "#parentx",
|
|
|
|
collision: "none"
|
2015-08-24 13:33:22 +00:00
|
|
|
} );
|
2016-04-06 13:05:47 +00:00
|
|
|
assert.deepEqual( $( "#elx" ).offset(), { top: 58, left: 50 }, "percentage offsets in at" );
|
2011-03-22 16:25:25 +00:00
|
|
|
|
2015-08-24 13:33:22 +00:00
|
|
|
$( "#elx" ).position( {
|
2011-03-22 17:12:03 +00:00
|
|
|
my: "left-30% top+50%",
|
|
|
|
at: "left bottom",
|
|
|
|
of: "#parentx",
|
|
|
|
collision: "none"
|
2015-08-24 13:33:22 +00:00
|
|
|
} );
|
2016-04-06 13:05:47 +00:00
|
|
|
assert.deepEqual( $( "#elx" ).offset(), { top: 65, left: 37 }, "percentage offsets in my" );
|
2013-02-12 02:04:28 +00:00
|
|
|
|
2015-08-24 13:33:22 +00:00
|
|
|
$( "#elx" ).position( {
|
2013-02-12 02:04:28 +00:00
|
|
|
my: "left-30.001% top+50.0%",
|
|
|
|
at: "left bottom",
|
|
|
|
of: "#parentx",
|
|
|
|
collision: "none"
|
2015-08-24 13:33:22 +00:00
|
|
|
} );
|
2013-03-31 16:28:40 +00:00
|
|
|
offset = $( "#elx" ).offset();
|
2016-04-06 13:05:47 +00:00
|
|
|
assert.equal( Math.round( offset.top ), 65, "decimal percentage offsets in my" );
|
|
|
|
assert.equal( Math.round( offset.left ), 37, "decimal percentage offsets in my" );
|
2013-02-12 02:04:28 +00:00
|
|
|
|
2015-08-24 13:33:22 +00:00
|
|
|
$( "#elx" ).position( {
|
2013-02-12 02:04:28 +00:00
|
|
|
my: "left+10.4 top-10.6",
|
|
|
|
at: "left bottom",
|
|
|
|
of: "#parentx",
|
|
|
|
collision: "none"
|
2015-08-24 13:33:22 +00:00
|
|
|
} );
|
2013-03-31 16:28:40 +00:00
|
|
|
offset = $( "#elx" ).offset();
|
2016-04-06 13:05:47 +00:00
|
|
|
assert.equal( Math.round( offset.top ), 49, "decimal offsets in my" );
|
|
|
|
assert.equal( Math.round( offset.left ), 50, "decimal offsets in my" );
|
2013-02-12 02:04:28 +00:00
|
|
|
|
2015-08-24 13:33:22 +00:00
|
|
|
$( "#elx" ).position( {
|
2013-02-12 02:04:28 +00:00
|
|
|
my: "left+right top-left",
|
|
|
|
at: "left-top bottom-bottom",
|
|
|
|
of: "#parentx",
|
|
|
|
collision: "none"
|
2015-08-24 13:33:22 +00:00
|
|
|
} );
|
2016-04-06 13:05:47 +00:00
|
|
|
assert.deepEqual( $( "#elx" ).offset(), { top: 60, left: 40 }, "invalid offsets" );
|
2015-08-24 13:33:22 +00:00
|
|
|
} );
|
2011-03-22 16:25:25 +00:00
|
|
|
|
2016-04-06 13:05:47 +00:00
|
|
|
QUnit.test( "using", function( assert ) {
|
|
|
|
assert.expect( 10 );
|
2010-01-07 03:19:50 +00:00
|
|
|
|
|
|
|
var count = 0,
|
2011-03-22 17:12:03 +00:00
|
|
|
elems = $( "#el1, #el2" ),
|
2012-04-24 14:17:02 +00:00
|
|
|
of = $( "#parentx" ),
|
|
|
|
expectedPosition = { top: 60, left: 60 },
|
|
|
|
expectedFeedback = {
|
|
|
|
target: {
|
|
|
|
element: of,
|
|
|
|
width: 20,
|
|
|
|
height: 20,
|
|
|
|
left: 40,
|
|
|
|
top: 40
|
|
|
|
},
|
|
|
|
element: {
|
|
|
|
width: 6,
|
|
|
|
height: 6,
|
|
|
|
left: 60,
|
|
|
|
top: 60
|
|
|
|
},
|
|
|
|
horizontal: "left",
|
|
|
|
vertical: "top",
|
|
|
|
important: "vertical"
|
|
|
|
},
|
2015-08-24 13:33:22 +00:00
|
|
|
originalPosition = elems.position( {
|
2011-03-22 17:12:03 +00:00
|
|
|
my: "right bottom",
|
|
|
|
at: "rigt bottom",
|
|
|
|
of: "#parentx",
|
|
|
|
collision: "none"
|
2015-08-24 13:33:22 +00:00
|
|
|
} ).offset();
|
2011-03-22 17:12:03 +00:00
|
|
|
|
2015-08-24 13:33:22 +00:00
|
|
|
elems.position( {
|
2011-03-22 17:12:03 +00:00
|
|
|
my: "left top",
|
2012-04-24 14:17:02 +00:00
|
|
|
at: "center+10 bottom",
|
2011-03-22 17:12:03 +00:00
|
|
|
of: "#parentx",
|
2012-04-24 14:17:02 +00:00
|
|
|
using: function( position, feedback ) {
|
2016-04-06 13:05:47 +00:00
|
|
|
assert.deepEqual( this, elems[ count ], "correct context for call #" + count );
|
|
|
|
assert.deepEqual( position, expectedPosition, "correct position for call #" + count );
|
|
|
|
assert.deepEqual( feedback.element.element[ 0 ], elems[ count ] );
|
2012-04-24 14:17:02 +00:00
|
|
|
delete feedback.element.element;
|
2016-04-06 13:05:47 +00:00
|
|
|
assert.deepEqual( feedback, expectedFeedback );
|
2010-01-07 03:19:50 +00:00
|
|
|
count++;
|
|
|
|
}
|
2015-08-24 13:33:22 +00:00
|
|
|
} );
|
2011-03-22 17:12:03 +00:00
|
|
|
|
2015-08-24 13:33:22 +00:00
|
|
|
elems.each( function() {
|
2016-04-06 13:05:47 +00:00
|
|
|
assert.deepEqual( $( this ).offset(), originalPosition, "elements not moved" );
|
2015-08-24 13:33:22 +00:00
|
|
|
} );
|
|
|
|
} );
|
2010-01-07 03:19:50 +00:00
|
|
|
|
2016-04-06 13:05:47 +00:00
|
|
|
function collisionTest( assert, config, result, msg ) {
|
2015-08-24 13:33:22 +00:00
|
|
|
var elem = $( "#elx" ).position( $.extend( {
|
2010-01-07 03:19:50 +00:00
|
|
|
my: "left top",
|
|
|
|
at: "right bottom",
|
2012-04-23 19:52:06 +00:00
|
|
|
of: "#parent"
|
2011-03-22 17:12:03 +00:00
|
|
|
}, config ) );
|
2016-04-06 13:05:47 +00:00
|
|
|
assert.deepEqual( elem.offset(), result, msg );
|
2010-01-07 03:19:50 +00:00
|
|
|
}
|
|
|
|
|
2016-04-06 13:05:47 +00:00
|
|
|
function collisionTest2( assert, config, result, msg ) {
|
|
|
|
collisionTest( assert, $.extend( {
|
2010-01-07 03:19:50 +00:00
|
|
|
my: "right bottom",
|
|
|
|
at: "left top"
|
2011-03-22 17:12:03 +00:00
|
|
|
}, config ), result, msg );
|
2010-01-07 03:19:50 +00:00
|
|
|
}
|
|
|
|
|
2016-04-06 13:05:47 +00:00
|
|
|
QUnit.test( "collision: fit, no collision", function( assert ) {
|
|
|
|
assert.expect( 2 );
|
2011-03-22 17:12:03 +00:00
|
|
|
|
2016-04-06 13:05:47 +00:00
|
|
|
collisionTest( assert, {
|
2010-01-07 03:19:50 +00:00
|
|
|
collision: "fit"
|
2012-04-23 19:52:06 +00:00
|
|
|
}, {
|
|
|
|
top: 10,
|
|
|
|
left: 10
|
|
|
|
}, "no offset" );
|
2010-01-07 03:19:50 +00:00
|
|
|
|
2016-04-06 13:05:47 +00:00
|
|
|
collisionTest( assert, {
|
2012-04-24 13:04:58 +00:00
|
|
|
collision: "fit",
|
2011-03-22 17:12:03 +00:00
|
|
|
at: "right+2 bottom+3"
|
2012-04-23 19:52:06 +00:00
|
|
|
}, {
|
|
|
|
top: 13,
|
|
|
|
left: 12
|
|
|
|
}, "with offset" );
|
2015-08-24 13:33:22 +00:00
|
|
|
} );
|
2012-04-23 19:52:06 +00:00
|
|
|
|
2012-11-05 16:31:33 +00:00
|
|
|
// Currently failing in IE8 due to the iframe used by TestSwarm
|
|
|
|
if ( !/msie [\w.]+/.exec( navigator.userAgent.toLowerCase() ) ) {
|
2016-04-06 13:05:47 +00:00
|
|
|
QUnit.test( "collision: fit, collision", function( assert ) {
|
|
|
|
assert.expect( 2 + ( scrollTopSupport() ? 1 : 0 ) );
|
2011-03-22 17:12:03 +00:00
|
|
|
|
2016-04-06 13:05:47 +00:00
|
|
|
collisionTest2( assert, {
|
2012-04-23 19:52:06 +00:00
|
|
|
collision: "fit"
|
|
|
|
}, {
|
|
|
|
top: 0,
|
|
|
|
left: 0
|
|
|
|
}, "no offset" );
|
2011-03-22 17:12:03 +00:00
|
|
|
|
2016-04-06 13:05:47 +00:00
|
|
|
collisionTest2( assert, {
|
2010-01-07 03:19:50 +00:00
|
|
|
collision: "fit",
|
2012-04-23 19:52:06 +00:00
|
|
|
at: "left+2 top+3"
|
|
|
|
}, {
|
|
|
|
top: 0,
|
|
|
|
left: 0
|
|
|
|
}, "with offset" );
|
2010-01-07 03:19:50 +00:00
|
|
|
|
2011-05-03 08:38:17 +00:00
|
|
|
if ( scrollTopSupport() ) {
|
2011-05-16 23:46:21 +00:00
|
|
|
win.scrollTop( 300 ).scrollLeft( 200 );
|
2016-04-06 13:05:47 +00:00
|
|
|
collisionTest( assert, {
|
2012-04-23 19:52:06 +00:00
|
|
|
collision: "fit"
|
|
|
|
}, {
|
|
|
|
top: 300,
|
|
|
|
left: 200
|
|
|
|
}, "window scrolled" );
|
2011-05-16 23:46:21 +00:00
|
|
|
|
2011-05-03 08:38:17 +00:00
|
|
|
win.scrollTop( 0 ).scrollLeft( 0 );
|
|
|
|
}
|
2015-08-24 13:33:22 +00:00
|
|
|
} );
|
2012-11-05 16:31:33 +00:00
|
|
|
}
|
2011-05-03 08:38:17 +00:00
|
|
|
|
2016-04-06 13:05:47 +00:00
|
|
|
QUnit.test( "collision: flip, no collision", function( assert ) {
|
|
|
|
assert.expect( 2 );
|
2011-03-22 17:12:03 +00:00
|
|
|
|
2016-04-06 13:05:47 +00:00
|
|
|
collisionTest( assert, {
|
2010-01-07 03:19:50 +00:00
|
|
|
collision: "flip"
|
2012-04-23 19:52:06 +00:00
|
|
|
}, {
|
|
|
|
top: 10,
|
|
|
|
left: 10
|
|
|
|
}, "no offset" );
|
2010-01-07 03:19:50 +00:00
|
|
|
|
2016-04-06 13:05:47 +00:00
|
|
|
collisionTest( assert, {
|
2010-01-07 03:19:50 +00:00
|
|
|
collision: "flip",
|
2011-03-22 17:12:03 +00:00
|
|
|
at: "right+2 bottom+3"
|
2012-04-23 19:52:06 +00:00
|
|
|
}, {
|
|
|
|
top: 13,
|
|
|
|
left: 12
|
|
|
|
}, "with offset" );
|
2015-08-24 13:33:22 +00:00
|
|
|
} );
|
2012-04-23 19:52:06 +00:00
|
|
|
|
2016-04-06 13:05:47 +00:00
|
|
|
QUnit.test( "collision: flip, collision", function( assert ) {
|
|
|
|
assert.expect( 2 );
|
2011-03-22 17:12:03 +00:00
|
|
|
|
2016-04-06 13:05:47 +00:00
|
|
|
collisionTest2( assert, {
|
2012-04-23 19:52:06 +00:00
|
|
|
collision: "flip"
|
|
|
|
}, {
|
|
|
|
top: 10,
|
|
|
|
left: 10
|
|
|
|
}, "no offset" );
|
2011-03-22 17:12:03 +00:00
|
|
|
|
2016-04-06 13:05:47 +00:00
|
|
|
collisionTest2( assert, {
|
2010-01-07 03:19:50 +00:00
|
|
|
collision: "flip",
|
2012-04-23 19:52:06 +00:00
|
|
|
at: "left+2 top+3"
|
|
|
|
}, {
|
|
|
|
top: 7,
|
|
|
|
left: 8
|
|
|
|
}, "with offset" );
|
2015-08-24 13:33:22 +00:00
|
|
|
} );
|
2010-01-07 03:19:50 +00:00
|
|
|
|
2016-04-06 13:05:47 +00:00
|
|
|
QUnit.test( "collision: flipfit, no collision", function( assert ) {
|
|
|
|
assert.expect( 2 );
|
2012-04-23 20:07:58 +00:00
|
|
|
|
2016-04-06 13:05:47 +00:00
|
|
|
collisionTest( assert, {
|
2012-04-23 20:07:58 +00:00
|
|
|
collision: "flipfit"
|
|
|
|
}, {
|
|
|
|
top: 10,
|
|
|
|
left: 10
|
|
|
|
}, "no offset" );
|
|
|
|
|
2016-04-06 13:05:47 +00:00
|
|
|
collisionTest( assert, {
|
2012-04-23 20:07:58 +00:00
|
|
|
collision: "flipfit",
|
|
|
|
at: "right+2 bottom+3"
|
|
|
|
}, {
|
|
|
|
top: 13,
|
|
|
|
left: 12
|
|
|
|
}, "with offset" );
|
2015-08-24 13:33:22 +00:00
|
|
|
} );
|
2012-04-23 20:07:58 +00:00
|
|
|
|
2016-04-06 13:05:47 +00:00
|
|
|
QUnit.test( "collision: flipfit, collision", function( assert ) {
|
|
|
|
assert.expect( 2 );
|
2012-04-23 20:07:58 +00:00
|
|
|
|
2016-04-06 13:05:47 +00:00
|
|
|
collisionTest2( assert, {
|
2012-04-23 20:07:58 +00:00
|
|
|
collision: "flipfit"
|
|
|
|
}, {
|
|
|
|
top: 10,
|
|
|
|
left: 10
|
|
|
|
}, "no offset" );
|
|
|
|
|
2016-04-06 13:05:47 +00:00
|
|
|
collisionTest2( assert, {
|
2012-04-23 20:07:58 +00:00
|
|
|
collision: "flipfit",
|
|
|
|
at: "left+2 top+3"
|
|
|
|
}, {
|
|
|
|
top: 7,
|
|
|
|
left: 8
|
|
|
|
}, "with offset" );
|
2015-08-24 13:33:22 +00:00
|
|
|
} );
|
2012-04-23 20:07:58 +00:00
|
|
|
|
2016-04-06 13:05:47 +00:00
|
|
|
QUnit.test( "collision: none, no collision", function( assert ) {
|
|
|
|
assert.expect( 2 );
|
2011-03-22 17:12:03 +00:00
|
|
|
|
2016-04-06 13:05:47 +00:00
|
|
|
collisionTest( assert, {
|
2010-01-07 03:19:50 +00:00
|
|
|
collision: "none"
|
2012-04-23 19:52:06 +00:00
|
|
|
}, {
|
|
|
|
top: 10,
|
|
|
|
left: 10
|
|
|
|
}, "no offset" );
|
2010-01-07 03:19:50 +00:00
|
|
|
|
2016-04-06 13:05:47 +00:00
|
|
|
collisionTest( assert, {
|
2010-01-07 03:19:50 +00:00
|
|
|
collision: "none",
|
2011-03-22 17:12:03 +00:00
|
|
|
at: "right+2 bottom+3"
|
2012-04-23 19:52:06 +00:00
|
|
|
}, {
|
|
|
|
top: 13,
|
|
|
|
left: 12
|
|
|
|
}, "with offset" );
|
2015-08-24 13:33:22 +00:00
|
|
|
} );
|
2012-04-23 19:52:06 +00:00
|
|
|
|
2016-04-06 13:05:47 +00:00
|
|
|
QUnit.test( "collision: none, collision", function( assert ) {
|
|
|
|
assert.expect( 2 );
|
2011-03-22 17:12:03 +00:00
|
|
|
|
2016-04-06 13:05:47 +00:00
|
|
|
collisionTest2( assert, {
|
2012-04-23 19:52:06 +00:00
|
|
|
collision: "none"
|
|
|
|
}, {
|
|
|
|
top: -6,
|
|
|
|
left: -6
|
|
|
|
}, "no offset" );
|
2011-03-22 17:12:03 +00:00
|
|
|
|
2016-04-06 13:05:47 +00:00
|
|
|
collisionTest2( assert, {
|
2010-01-07 03:19:50 +00:00
|
|
|
collision: "none",
|
2012-04-23 19:52:06 +00:00
|
|
|
at: "left+2 top+3"
|
|
|
|
}, {
|
|
|
|
top: -3,
|
|
|
|
left: -4
|
|
|
|
}, "with offset" );
|
2015-08-24 13:33:22 +00:00
|
|
|
} );
|
2010-01-07 03:19:50 +00:00
|
|
|
|
2016-04-06 13:05:47 +00:00
|
|
|
QUnit.test( "collision: fit, with margin", function( assert ) {
|
|
|
|
assert.expect( 2 );
|
2010-09-03 14:38:44 +00:00
|
|
|
|
2015-08-24 13:33:22 +00:00
|
|
|
$( "#elx" ).css( {
|
2012-04-23 19:52:06 +00:00
|
|
|
marginTop: 6,
|
|
|
|
marginLeft: 4
|
2015-08-24 13:33:22 +00:00
|
|
|
} );
|
2010-09-03 14:38:44 +00:00
|
|
|
|
2016-04-06 13:05:47 +00:00
|
|
|
collisionTest( assert, {
|
2010-09-03 14:38:44 +00:00
|
|
|
collision: "fit"
|
2012-04-23 19:52:06 +00:00
|
|
|
}, {
|
|
|
|
top: 10,
|
|
|
|
left: 10
|
|
|
|
}, "right bottom" );
|
2010-09-03 14:38:44 +00:00
|
|
|
|
2016-04-06 13:05:47 +00:00
|
|
|
collisionTest2( assert, {
|
2010-09-03 14:38:44 +00:00
|
|
|
collision: "fit"
|
2012-04-23 19:52:06 +00:00
|
|
|
}, {
|
|
|
|
top: 6,
|
|
|
|
left: 4
|
|
|
|
}, "left top" );
|
2015-08-24 13:33:22 +00:00
|
|
|
} );
|
2012-04-23 19:52:06 +00:00
|
|
|
|
2016-04-06 13:05:47 +00:00
|
|
|
QUnit.test( "collision: flip, with margin", function( assert ) {
|
|
|
|
assert.expect( 3 );
|
2010-09-03 14:38:44 +00:00
|
|
|
|
2015-08-24 13:33:22 +00:00
|
|
|
$( "#elx" ).css( {
|
2012-04-23 19:52:06 +00:00
|
|
|
marginTop: 6,
|
|
|
|
marginLeft: 4
|
2015-08-24 13:33:22 +00:00
|
|
|
} );
|
2010-09-03 14:38:44 +00:00
|
|
|
|
2016-04-06 13:05:47 +00:00
|
|
|
collisionTest( assert, {
|
2012-04-23 19:52:06 +00:00
|
|
|
collision: "flip"
|
|
|
|
}, {
|
|
|
|
top: 10,
|
|
|
|
left: 10
|
|
|
|
}, "left top" );
|
2010-09-03 14:38:44 +00:00
|
|
|
|
2016-04-06 13:05:47 +00:00
|
|
|
collisionTest2( assert, {
|
2012-04-23 19:52:06 +00:00
|
|
|
collision: "flip"
|
|
|
|
}, {
|
|
|
|
top: 10,
|
|
|
|
left: 10
|
|
|
|
}, "right bottom" );
|
2010-09-03 14:38:44 +00:00
|
|
|
|
2016-04-06 13:05:47 +00:00
|
|
|
collisionTest2( assert, {
|
2010-09-03 14:38:44 +00:00
|
|
|
collision: "flip",
|
2012-04-23 19:52:06 +00:00
|
|
|
my: "left top"
|
|
|
|
}, {
|
|
|
|
top: 0,
|
|
|
|
left: 4
|
|
|
|
}, "right bottom" );
|
2015-08-24 13:33:22 +00:00
|
|
|
} );
|
2011-07-11 23:49:56 +00:00
|
|
|
|
2016-04-06 13:05:47 +00:00
|
|
|
QUnit.test( "within", function( assert ) {
|
|
|
|
assert.expect( 7 );
|
2013-09-04 22:13:53 +00:00
|
|
|
|
2016-04-06 13:05:47 +00:00
|
|
|
collisionTest( assert, {
|
2013-09-04 22:13:53 +00:00
|
|
|
within: document
|
|
|
|
}, {
|
|
|
|
top: 10,
|
|
|
|
left: 10
|
|
|
|
}, "within document" );
|
2011-07-11 23:49:56 +00:00
|
|
|
|
2016-04-06 13:05:47 +00:00
|
|
|
collisionTest( assert, {
|
2012-04-23 19:52:06 +00:00
|
|
|
within: "#within",
|
|
|
|
collision: "fit"
|
|
|
|
}, {
|
|
|
|
top: 4,
|
|
|
|
left: 2
|
|
|
|
}, "fit - right bottom" );
|
2011-07-11 23:49:56 +00:00
|
|
|
|
2016-04-06 13:05:47 +00:00
|
|
|
collisionTest2( assert, {
|
2012-04-23 19:52:06 +00:00
|
|
|
within: "#within",
|
|
|
|
collision: "fit"
|
|
|
|
}, {
|
|
|
|
top: 2,
|
|
|
|
left: 0
|
|
|
|
}, "fit - left top" );
|
2011-08-13 03:19:52 +00:00
|
|
|
|
2016-04-06 13:05:47 +00:00
|
|
|
collisionTest( assert, {
|
2012-04-23 19:52:06 +00:00
|
|
|
within: "#within",
|
|
|
|
collision: "flip"
|
|
|
|
}, {
|
|
|
|
top: 10,
|
|
|
|
left: -6
|
2012-04-23 20:07:58 +00:00
|
|
|
}, "flip - right bottom" );
|
2011-07-11 23:49:56 +00:00
|
|
|
|
2016-04-06 13:05:47 +00:00
|
|
|
collisionTest2( assert, {
|
2012-04-23 19:52:06 +00:00
|
|
|
within: "#within",
|
|
|
|
collision: "flip"
|
|
|
|
}, {
|
|
|
|
top: 10,
|
|
|
|
left: -6
|
2012-04-23 20:07:58 +00:00
|
|
|
}, "flip - left top" );
|
|
|
|
|
2016-04-06 13:05:47 +00:00
|
|
|
collisionTest( assert, {
|
2012-04-23 20:07:58 +00:00
|
|
|
within: "#within",
|
|
|
|
collision: "flipfit"
|
|
|
|
}, {
|
|
|
|
top: 4,
|
|
|
|
left: 0
|
|
|
|
}, "flipfit - right bottom" );
|
|
|
|
|
2016-04-06 13:05:47 +00:00
|
|
|
collisionTest2( assert, {
|
2012-04-23 20:07:58 +00:00
|
|
|
within: "#within",
|
|
|
|
collision: "flipfit"
|
|
|
|
}, {
|
|
|
|
top: 4,
|
|
|
|
left: 0
|
|
|
|
}, "flipfit - left top" );
|
2015-08-24 13:33:22 +00:00
|
|
|
} );
|
2011-07-11 23:49:56 +00:00
|
|
|
|
2016-04-06 13:05:47 +00:00
|
|
|
QUnit.test( "with scrollbars", function( assert ) {
|
|
|
|
assert.expect( 4 );
|
2012-04-24 15:23:25 +00:00
|
|
|
|
2015-08-24 13:33:22 +00:00
|
|
|
$( "#scrollx" ).css( {
|
2012-04-24 15:23:25 +00:00
|
|
|
width: 100,
|
|
|
|
height: 100,
|
|
|
|
left: 0,
|
|
|
|
top: 0
|
2015-08-24 13:33:22 +00:00
|
|
|
} );
|
2012-04-24 15:23:25 +00:00
|
|
|
|
2016-04-06 13:05:47 +00:00
|
|
|
collisionTest( assert, {
|
2012-04-24 15:23:25 +00:00
|
|
|
of: "#scrollx",
|
|
|
|
collision: "fit",
|
|
|
|
within: "#scrollx"
|
|
|
|
}, {
|
|
|
|
top: 90,
|
|
|
|
left: 90
|
|
|
|
}, "visible" );
|
|
|
|
|
2015-08-24 13:33:22 +00:00
|
|
|
$( "#scrollx" ).css( {
|
2012-04-24 15:23:25 +00:00
|
|
|
overflow: "scroll"
|
2015-08-24 13:33:22 +00:00
|
|
|
} );
|
2012-04-24 15:23:25 +00:00
|
|
|
|
|
|
|
var scrollbarInfo = $.position.getScrollInfo( $.position.getWithinInfo( $( "#scrollx" ) ) );
|
|
|
|
|
2016-04-06 13:05:47 +00:00
|
|
|
collisionTest( assert, {
|
2012-04-24 15:23:25 +00:00
|
|
|
of: "#scrollx",
|
|
|
|
collision: "fit",
|
|
|
|
within: "#scrollx"
|
|
|
|
}, {
|
|
|
|
top: 90 - scrollbarInfo.height,
|
|
|
|
left: 90 - scrollbarInfo.width
|
|
|
|
}, "scroll" );
|
|
|
|
|
2015-08-24 13:33:22 +00:00
|
|
|
$( "#scrollx" ).css( {
|
2012-04-24 15:23:25 +00:00
|
|
|
overflow: "auto"
|
2015-08-24 13:33:22 +00:00
|
|
|
} );
|
2012-04-24 15:23:25 +00:00
|
|
|
|
2016-04-06 13:05:47 +00:00
|
|
|
collisionTest( assert, {
|
2012-04-24 15:23:25 +00:00
|
|
|
of: "#scrollx",
|
|
|
|
collision: "fit",
|
|
|
|
within: "#scrollx"
|
|
|
|
}, {
|
|
|
|
top: 90,
|
|
|
|
left: 90
|
|
|
|
}, "auto, no scroll" );
|
|
|
|
|
2015-08-24 13:33:22 +00:00
|
|
|
$( "#scrollx" ).css( {
|
2012-04-24 15:23:25 +00:00
|
|
|
overflow: "auto"
|
2015-08-24 13:33:22 +00:00
|
|
|
} ).append( $( "<div>" ).height( 300 ).width( 300 ) );
|
2012-04-24 15:23:25 +00:00
|
|
|
|
2016-04-06 13:05:47 +00:00
|
|
|
collisionTest( assert, {
|
2012-04-24 15:23:25 +00:00
|
|
|
of: "#scrollx",
|
|
|
|
collision: "fit",
|
|
|
|
within: "#scrollx"
|
|
|
|
}, {
|
|
|
|
top: 90 - scrollbarInfo.height,
|
|
|
|
left: 90 - scrollbarInfo.width
|
|
|
|
}, "auto, with scroll" );
|
2015-08-24 13:33:22 +00:00
|
|
|
} );
|
2012-04-24 15:23:25 +00:00
|
|
|
|
2016-04-06 13:05:47 +00:00
|
|
|
QUnit.test( "fractions", function( assert ) {
|
|
|
|
assert.expect( 1 );
|
2012-04-23 19:52:06 +00:00
|
|
|
|
2015-08-24 13:33:22 +00:00
|
|
|
$( "#fractions-element" ).position( {
|
2011-08-13 03:19:52 +00:00
|
|
|
my: "left top",
|
|
|
|
at: "left top",
|
|
|
|
of: "#fractions-parent",
|
|
|
|
collision: "none"
|
2015-08-24 13:33:22 +00:00
|
|
|
} );
|
2016-04-06 13:05:47 +00:00
|
|
|
assert.deepEqual( $( "#fractions-element" ).offset(), $( "#fractions-parent" ).offset(), "left top, left top" );
|
2015-08-24 13:33:22 +00:00
|
|
|
} );
|
2011-08-13 03:19:52 +00:00
|
|
|
|
2016-04-06 13:05:47 +00:00
|
|
|
QUnit.test( "bug #5280: consistent results (avoid fractional values)", function( assert ) {
|
|
|
|
assert.expect( 1 );
|
2012-04-23 19:52:06 +00:00
|
|
|
|
2011-08-13 03:19:52 +00:00
|
|
|
var wrapper = $( "#bug-5280" ),
|
|
|
|
elem = wrapper.children(),
|
2015-08-24 13:33:22 +00:00
|
|
|
offset1 = elem.position( {
|
2011-08-13 03:19:52 +00:00
|
|
|
my: "center",
|
|
|
|
at: "center",
|
|
|
|
of: wrapper,
|
|
|
|
collision: "none"
|
2015-08-24 13:33:22 +00:00
|
|
|
} ).offset(),
|
|
|
|
offset2 = elem.position( {
|
2011-08-13 03:19:52 +00:00
|
|
|
my: "center",
|
|
|
|
at: "center",
|
|
|
|
of: wrapper,
|
|
|
|
collision: "none"
|
2015-08-24 13:33:22 +00:00
|
|
|
} ).offset();
|
2016-04-06 13:05:47 +00:00
|
|
|
assert.deepEqual( offset1, offset2 );
|
2015-08-24 13:33:22 +00:00
|
|
|
} );
|
2010-03-26 23:53:43 +00:00
|
|
|
|
2016-04-06 13:05:47 +00:00
|
|
|
QUnit.test( "bug #8710: flip if flipped position fits more", function( assert ) {
|
|
|
|
assert.expect( 3 );
|
2013-09-04 21:20:45 +00:00
|
|
|
|
|
|
|
// Positions a 10px tall element within 99px height at top 90px.
|
2016-04-06 13:05:47 +00:00
|
|
|
collisionTest( assert, {
|
2013-09-04 21:20:45 +00:00
|
|
|
within: "#bug-8710-within-smaller",
|
|
|
|
of: "#parentx",
|
|
|
|
collision: "flip",
|
|
|
|
at: "right bottom+30"
|
|
|
|
}, {
|
|
|
|
top: 0,
|
|
|
|
left: 60
|
|
|
|
}, "flip - top fits all" );
|
|
|
|
|
|
|
|
// Positions a 10px tall element within 99px height at top 92px.
|
2016-04-06 13:05:47 +00:00
|
|
|
collisionTest( assert, {
|
2013-09-04 21:20:45 +00:00
|
|
|
within: "#bug-8710-within-smaller",
|
|
|
|
of: "#parentx",
|
|
|
|
collision: "flip",
|
|
|
|
at: "right bottom+32"
|
|
|
|
}, {
|
|
|
|
top: -2,
|
|
|
|
left: 60
|
|
|
|
}, "flip - top fits more" );
|
|
|
|
|
|
|
|
// Positions a 10px tall element within 101px height at top 92px.
|
2016-04-06 13:05:47 +00:00
|
|
|
collisionTest( assert, {
|
2013-09-04 21:20:45 +00:00
|
|
|
within: "#bug-8710-within-bigger",
|
|
|
|
of: "#parentx",
|
|
|
|
collision: "flip",
|
|
|
|
at: "right bottom+32"
|
|
|
|
}, {
|
|
|
|
top: 92,
|
|
|
|
left: 60
|
|
|
|
}, "no flip - top fits less" );
|
2015-08-24 13:33:22 +00:00
|
|
|
} );
|
2013-09-04 21:20:45 +00:00
|
|
|
|
2015-04-06 17:08:27 +00:00
|
|
|
} );
|