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