2db5a26d1903edffa8b37436372da2a00b60dc2f.svn-base 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  1. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
  2. "http://www.w3.org/TR/html4/strict.dtd">
  3. <html dir="rtl">
  4. <head>
  5. <title>testing Core HTML/DOM/CSS/Style utils</title>
  6. <style type="text/css">
  7. @import "../../resources/dojo.css";
  8. </style>
  9. <script type="text/javascript"
  10. src="../../dojo.js"
  11. djConfig="isDebug: true"></script>
  12. <script type="text/javascript">
  13. dojo.require("doh.runner");
  14. dojo.addOnLoad(function(){
  15. doh.register("t",
  16. [
  17. function coordsWithVertScrollbar(t){
  18. // show vertical scrollbar
  19. dojo.byId("rect_vert").style.display = "";
  20. try{
  21. t.is(100, dojo.coords('rect100').x);
  22. }finally{
  23. dojo.byId("rect_vert").style.display = "none";
  24. }
  25. },
  26. function coordsWithHorzScrollbar(t){
  27. // show horizonal scrollbar & scroll a bit left
  28. dojo.byId("rect_horz").style.display = "";
  29. scrollBy(-50, 0);
  30. try{
  31. t.is(100, dojo.coords('rect100', true).x);
  32. }finally{
  33. dojo.byId("rect_horz").style.display = "none";
  34. }
  35. },
  36. function eventClientXY(t){ // IE only test
  37. if(dojo.isIE){
  38. // show vertical scrollbar
  39. dojo.byId("rect_vert").style.display = "";
  40. var rect = dojo.byId("rect100");
  41. var assertException = null;
  42. function rect_onclick(e){
  43. // move the rectangle to the mouse point
  44. rect.style.left = e.pageX + "px";
  45. rect.style.top = e.pageY + "px";
  46. window.alert("Do NOT move your mouse!!!\n\n" +
  47. "The black rectangle's top-left point should be under the mouse point.\n\n" +
  48. "If not, you will see a failure in the test report later.\n\n" +
  49. "Now press the space bar, but do NOT move your mouse.");
  50. rect.fireEvent('ondblclick');
  51. }
  52. function rect_ondblclick(){
  53. // test if the rectangle is really under the mouse point
  54. try{
  55. t.is(0, event.offsetX);
  56. t.is(0, event.offsetY);
  57. }catch (e){ // allow the exception in a event handler go to the event firer
  58. assertException = e;
  59. }
  60. }
  61. dojo.connect(rect, "onclick", null, rect_onclick);
  62. dojo.connect(rect, "ondblclick", null, rect_ondblclick);
  63. window.alert("Move the mouse to anywhere in this page, and then press the space bar.");
  64. rect.fireEvent('onclick');
  65. if(assertException != null){
  66. throw assertException;
  67. }
  68. }
  69. }
  70. ]
  71. );
  72. doh.run();
  73. });
  74. </script>
  75. <style type="text/css">
  76. #rect100 {
  77. background-color: black;
  78. color: white;
  79. position: absolute;
  80. left: 100px;
  81. top: 100px;
  82. width: 100px;
  83. height: 100px;
  84. border: 0px;
  85. padding: 0px;
  86. margin: 0px;
  87. overflow: hidden;
  88. }
  89. </style>
  90. </head>
  91. <body>
  92. <h1>testing Core HTML/DOM/CSS/Style utils</h1>
  93. <div id="rect100">
  94. 100px rect, abs,
  95. mouse point is at top-left after the test "eventClientXY"
  96. </div>
  97. <div id="rect_vert" style="height:1600px;display:none">show vertical scrollbar</div>
  98. <div id="rect_horz" style="width:1600px;display:none">show horizonal scrollbar</div>
  99. </body>
  100. </html>