Ticket #3545: test_element_getDocumentPosition.patch
File test_element_getDocumentPosition.patch, 2.4 KB (added by , 15 years ago) |
---|
-
_source/tests/core/dom/element.html
506 506 var element = new CKEDITOR.dom.element( document.getElementsByTagName( 'small' )[0] ); 507 507 assert.isTrue( element.hasAttributes() ); 508 508 }, 509 509 510 test_getDocumentPosition : function() 511 { 512 // Assign the page location of the element. 513 YAHOO.util.Dom.setXY('DocPositionTarget', [ 350, 450 ] ); 514 var pos = CKEDITOR.document.getById( 'DocPositionTarget' ).getDocumentPosition(); 515 if ( !CKEDITOR.env.ie ) 516 { 517 assert.areEqual( 350, pos.x, 'Position coordinates:x relative to document doesn\'t match.' ); 518 assert.areEqual( 450, pos.y, 'Position coordinates:y relative to document doesn\'t match.' ); 519 } 520 else 521 { 522 assert.isTrue( pos.x == 348 || pos.x == 349, 'Position coordinates:x relative to document doesn\'t match.' ); 523 assert.areEqual( 448, pos.y, 'Position coordinates:y relative to document doesn\'t match.' ); 524 } 525 }, 526 510 527 name : document.title 511 528 }; 512 529 })() ); 513 530 514 531 //]]> 515 532 </script> 533 <style type="text/css" media="screen"> 534 #test-computed { 535 width:50%; 536 margin:auto; 537 padding:10px; 538 z-index: 2; 539 } 540 .scroll 541 { 542 overflow: visible; 543 } 544 .block1 545 { 546 width: 100%; 547 height: 100px; 548 background-color: blue; 549 text-align: center; 550 } 551 .block2 552 { 553 margin: auto; 554 width: 200px; 555 height: 200px; 556 background-color: green; 557 position : relative; 558 } 559 .block3 560 { 561 position: absolute; 562 float:right; 563 width: 300px; 564 height: 300px; 565 background-color: black; 566 } 567 .block4 568 { 569 position: absolute; 570 left: 50px; 571 right: 50px; 572 width: 400px; 573 height: 400px; 574 background-color: pink; 575 } 576 #DocPositionTarget 577 { 578 background-color: red; 579 } 580 </style> 516 581 </head> 517 582 <body> 518 583 <textarea id="test1" rows="10" cols="80"></textarea> … … 536 601 B</div> 537 602 <big>Test</big> 538 603 <small title="Testing">Test</small> 604 605 <div class="block1 scroll" id="block1"><div class="block2 scroll" id="block2"><div class="block3 scroll" id="block3"><div class="block4 scroll" id="block4"><div id="DocPositionTarget">target</div></div></div></div></div> 606 539 607 </body> 540 608 </html>