Skip to content

Commit 1a0f2e4

Browse files
committed
Position: Extend unit test for using to check feedback properties
1 parent 0f575e0 commit 1a0f2e4

File tree

1 file changed

+26
-4
lines changed

1 file changed

+26
-4
lines changed

tests/unit/position/position_core.js

Lines changed: 26 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -255,11 +255,30 @@ test( "offsets", function() {
255255
});
256256

257257
test( "using", function() {
258-
expect( 6 );
258+
expect( 10 );
259259

260260
var count = 0,
261261
elems = $( "#el1, #el2" ),
262-
expectedPosition = { top: 40, left: 40 },
262+
of = $( "#parentx" ),
263+
expectedPosition = { top: 60, left: 60 },
264+
expectedFeedback = {
265+
target: {
266+
element: of,
267+
width: 20,
268+
height: 20,
269+
left: 40,
270+
top: 40
271+
},
272+
element: {
273+
width: 6,
274+
height: 6,
275+
left: 60,
276+
top: 60
277+
},
278+
horizontal: "left",
279+
vertical: "top",
280+
important: "vertical"
281+
},
263282
originalPosition = elems.position({
264283
my: "right bottom",
265284
at: "rigt bottom",
@@ -269,11 +288,14 @@ test( "using", function() {
269288

270289
elems.position({
271290
my: "left top",
272-
at: "left top",
291+
at: "center+10 bottom",
273292
of: "#parentx",
274-
using: function( position ) {
293+
using: function( position, feedback ) {
275294
deepEqual( this, elems[ count ], "correct context for call #" + count );
276295
deepEqual( position, expectedPosition, "correct position for call #" + count );
296+
deepEqual( feedback.element.element[ 0 ], elems[ count ] );
297+
delete feedback.element.element;
298+
deepEqual( feedback, expectedFeedback );
277299
count++;
278300
}
279301
});

0 commit comments

Comments
 (0)