Skip to content

Commit

Permalink
Position: Extend unit test for using to check feedback properties
Browse files Browse the repository at this point in the history
  • Loading branch information
jzaefferer committed Apr 24, 2012
1 parent 0f575e0 commit 1a0f2e4
Showing 1 changed file with 26 additions and 4 deletions.
30 changes: 26 additions & 4 deletions tests/unit/position/position_core.js
Expand Up @@ -255,11 +255,30 @@ test( "offsets", function() {
});

test( "using", function() {
expect( 6 );
expect( 10 );

var count = 0,
elems = $( "#el1, #el2" ),
expectedPosition = { top: 40, left: 40 },
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"
},
originalPosition = elems.position({
my: "right bottom",
at: "rigt bottom",
Expand All @@ -269,11 +288,14 @@ test( "using", function() {

elems.position({
my: "left top",
at: "left top",
at: "center+10 bottom",
of: "#parentx",
using: function( position ) {
using: function( position, feedback ) {
deepEqual( this, elems[ count ], "correct context for call #" + count );
deepEqual( position, expectedPosition, "correct position for call #" + count );
deepEqual( feedback.element.element[ 0 ], elems[ count ] );
delete feedback.element.element;
deepEqual( feedback, expectedFeedback );
count++;
}
});
Expand Down

0 comments on commit 1a0f2e4

Please sign in to comment.