]> source.dussan.org Git - jquery-ui.git/commitdiff
Position: Extend unit test for using to check feedback properties
authorJörn Zaefferer <joern.zaefferer@gmail.com>
Tue, 24 Apr 2012 14:17:02 +0000 (16:17 +0200)
committerJörn Zaefferer <joern.zaefferer@gmail.com>
Tue, 24 Apr 2012 14:17:02 +0000 (16:17 +0200)
tests/unit/position/position_core.js

index 0ebcabef3ea6e4ff82d705a5bbf72e9adb63f50b..b567b7299ff9790c019525e3139d34daddd48430 100644 (file)
@@ -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",
@@ -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++;
                }
        });