@@ -332,28 +332,28 @@ test( "collision: fit, window scrolled", function() {
332
332
test ( "collision: flip, no offset" , function ( ) {
333
333
collisionTest ( {
334
334
collision : "flip"
335
- } , { top : - 10 , left : - 10 } , "left top" ) ;
335
+ } , { top : $ ( window ) . height ( ) , left : $ ( window ) . width ( ) } , "left top" ) ;
336
336
337
337
collisionTest2 ( {
338
338
collision : "flip"
339
- } , { top : $ ( window ) . height ( ) , left : $ ( window ) . width ( ) } , "right bottom" ) ;
339
+ } , { top : - 10 , left : - 10 } , "right bottom" ) ;
340
340
} ) ;
341
341
342
342
test ( "collision: flip, with offset" , function ( ) {
343
343
collisionTest ( {
344
344
collision : "flip" ,
345
345
at : "right+2 bottom+3"
346
- } , { top : - 13 , left : - 12 } , "left top, with offset added" ) ;
346
+ } , { top : $ ( window ) . height ( ) + 3 , left : $ ( window ) . width ( ) + 2 } , "left top, with offset added" ) ;
347
347
348
348
collisionTest2 ( {
349
349
collision : "flip" ,
350
350
at : "left+2 top+3"
351
- } , { top : $ ( window ) . height ( ) - 3 , left : $ ( window ) . width ( ) - 2 } , "bottom, positive offset" ) ;
351
+ } , { top : - 7 , left : - 8 } , "bottom, positive offset" ) ;
352
352
353
353
collisionTest2 ( {
354
354
collision : "flip" ,
355
355
at : "left-2 top-3"
356
- } , { top : $ ( window ) . height ( ) + 3 , left : $ ( window ) . width ( ) + 2 } , "right bottom, negative offset" ) ;
356
+ } , { top : - 13 , left : - 12 } , "right bottom, negative offset" ) ;
357
357
} ) ;
358
358
359
359
test ( "collision: none, no offset" , function ( ) {
@@ -427,12 +427,12 @@ test( "collision: flip, with margin", function() {
427
427
collisionTest ( {
428
428
collision : "flip" ,
429
429
at : "left top"
430
- } , { top : $ ( window ) . height ( ) - 10 , left : $ ( window ) . width ( ) - 10 } , "left top" ) ;
430
+ } , { top : 0 , left : 0 } , "left top" ) ;
431
431
432
432
collisionTest2 ( {
433
433
collision : "flip" ,
434
434
at : "right bottom"
435
- } , { top : 0 , left : 0 } , "right bottom" ) ;
435
+ } , { top : $ ( window ) . height ( ) - 10 , left : $ ( window ) . width ( ) - 10 } , "right bottom" ) ;
436
436
} ) ;
437
437
438
438
test ( "addClass: flipped left" , function ( ) {
@@ -443,15 +443,15 @@ test( "addClass: flipped left", function() {
443
443
at : "right center"
444
444
} ) ;
445
445
446
- same ( elem . hasClass ( 'ui-flipped-left' ) , true , 'Has ui-flipped-left class' ) ;
446
+ same ( elem . hasClass ( 'ui-flipped-left' ) , false , 'Has ui-flipped-left class' ) ;
447
447
448
448
elem . position ( {
449
449
my : "right center" ,
450
450
of : window ,
451
451
collision : "flip" ,
452
452
at : "left center"
453
453
} )
454
-
454
+
455
455
same ( elem . hasClass ( 'ui-flipped-left' ) , false , 'Removed ui-flipped-left class' ) ;
456
456
} ) ;
457
457
@@ -463,8 +463,8 @@ test( "addClass: flipped top", function() {
463
463
at : "right bottom"
464
464
} ) ;
465
465
466
- same ( elem . hasClass ( 'ui-flipped-top' ) , true , 'Has ui-flipped-top class' ) ;
467
-
466
+ same ( elem . hasClass ( 'ui-flipped-top' ) , false , 'Has ui-flipped-top class' ) ;
467
+
468
468
elem . position ( {
469
469
my : "left bottom" ,
470
470
of : window ,
@@ -483,7 +483,7 @@ test( "addClass: flipped right", function() {
483
483
at : "left center"
484
484
} ) ;
485
485
486
- same ( elem . hasClass ( 'ui-flipped-right' ) , true , 'Has ui-flipped-right class' ) ;
486
+ same ( elem . hasClass ( 'ui-flipped-right' ) , false , 'Has ui-flipped-right class' ) ;
487
487
488
488
elem . position ( {
489
489
my : "left center" ,
@@ -504,8 +504,8 @@ test( "addClass: flipped bottom", function() {
504
504
at : "right top"
505
505
} ) ;
506
506
507
- same ( elem . hasClass ( 'ui-flipped-bottom' ) , true , 'Has ui-flipped-bottom class' ) ;
508
-
507
+ same ( elem . hasClass ( 'ui-flipped-bottom' ) , false , 'Has ui-flipped-bottom class' ) ;
508
+
509
509
elem . position ( {
510
510
my : "left top" ,
511
511
of : window ,
@@ -516,22 +516,32 @@ test( "addClass: flipped bottom", function() {
516
516
same ( elem . hasClass ( 'ui-flipped-bottom' ) , false , 'Removed ui-flipped-bottom class' ) ;
517
517
} ) ;
518
518
519
- //test( "bug #5280: consistent results (avoid fractional values)", function() {
520
- // var wrapper = $( "#bug-5280" ),
521
- // elem = wrapper.children(),
522
- // offset1 = elem.position({
523
- // my: "center",
524
- // at: "center",
525
- // of: wrapper,
526
- // collision: "none"
527
- // }).offset(),
528
- // offset2 = elem.position({
529
- // my: "center",
530
- // at: "center",
531
- // of: wrapper,
532
- // collision: "none"
533
- // }).offset();
534
- // same( offset1, offset2 );
535
- //});
519
+ test ( "fractions" , function ( ) {
520
+ $ ( "#fractions-element" ) . position ( {
521
+ my : "left top" ,
522
+ at : "left top" ,
523
+ of : "#fractions-parent" ,
524
+ collision : "none"
525
+ } ) ;
526
+ same ( $ ( "#fractions-element" ) . offset ( ) , $ ( "#fractions-parent" ) . offset ( ) , "left top, left top" ) ;
527
+ } ) ;
528
+
529
+ test ( "bug #5280: consistent results (avoid fractional values)" , function ( ) {
530
+ var wrapper = $ ( "#bug-5280" ) ,
531
+ elem = wrapper . children ( ) ,
532
+ offset1 = elem . position ( {
533
+ my : "center" ,
534
+ at : "center" ,
535
+ of : wrapper ,
536
+ collision : "none"
537
+ } ) . offset ( ) ,
538
+ offset2 = elem . position ( {
539
+ my : "center" ,
540
+ at : "center" ,
541
+ of : wrapper ,
542
+ collision : "none"
543
+ } ) . offset ( ) ;
544
+ same ( offset1 , offset2 ) ;
545
+ } ) ;
536
546
537
547
} ( jQuery ) ) ;
0 commit comments