aboutsummaryrefslogtreecommitdiff
path: root/includes/js/dojo/tests/_base/html_rtl.html
blob: 8d74afab954e122a0efe4adf87c8c098120b831d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
	"http://www.w3.org/TR/html4/strict.dtd">
<html dir="rtl">
	<head>
		<title>testing Core HTML/DOM/CSS/Style utils</title>
		<style type="text/css">
			@import "../../resources/dojo.css";
		</style>
		<script type="text/javascript" 
			src="../../dojo.js" 
			djConfig="isDebug: true"></script>
		<script type="text/javascript">
			dojo.require("doh.runner");
			
			dojo.addOnLoad(function(){
				doh.register("t", 
					[
						function coordsWithVertScrollbar(t){
							// show vertical scrollbar
							dojo.byId("rect_vert").style.display = "";
							try{
								t.is(100, dojo.coords('rect100').x);
							}finally{
								dojo.byId("rect_vert").style.display = "none";
							}
						},

						function coordsWithHorzScrollbar(t){
							// show horizonal scrollbar & scroll a bit left
							dojo.byId("rect_horz").style.display = "";
							scrollBy(-50, 0);
							try{
								t.is(100, dojo.coords('rect100', true).x);
							}finally{
								dojo.byId("rect_horz").style.display = "none";
							}
						},

						function eventClientXY(t){ // IE only test
							if(dojo.isIE){
								// show vertical scrollbar
								dojo.byId("rect_vert").style.display = "";

								var rect = dojo.byId("rect100");
								var assertException = null;

								function rect_onclick(e){
									// move the rectangle to the mouse point
									rect.style.left = e.pageX + "px";
									rect.style.top = e.pageY + "px";
									window.alert("Do NOT move your mouse!!!\n\n" + 
												"The black rectangle's top-left point should be under the mouse point.\n\n" +
												"If not, you will see a failure in the test report later.\n\n" +
												"Now press the space bar, but do NOT move your mouse.");
									rect.fireEvent('ondblclick');
								}

								function rect_ondblclick(){
									// test if the rectangle is really under the mouse point
									try{
										t.is(0, event.offsetX);
										t.is(0, event.offsetY);
									}catch (e){ // allow the exception in a event handler go to the event firer 
										assertException = e;
									}
								}

								dojo.connect(rect, "onclick", null, rect_onclick);
								dojo.connect(rect, "ondblclick", null, rect_ondblclick);
								window.alert("Move the mouse to anywhere in this page, and then press the space bar.");
								rect.fireEvent('onclick');
								if(assertException != null){
									throw assertException;
								}
							}
						}
						
					]
				);
				doh.run();
			});
		</script>
		<style type="text/css">
			#rect100 {
				background-color: black;
				color: white;
				position: absolute;
				left: 100px;
				top: 100px;
				width: 100px;
				height: 100px;
				border: 0px;
				padding: 0px;
				margin: 0px;
				overflow: hidden;
			}

		</style>
	</head>
	<body>
		<h1>testing Core HTML/DOM/CSS/Style utils</h1>
		<div id="rect100">
			100px rect, abs, 
			mouse point is at top-left after the test "eventClientXY"
		</div>
		<div id="rect_vert" style="height:1600px;display:none">show vertical scrollbar</div>
		<div id="rect_horz" style="width:1600px;display:none">show horizonal scrollbar</div>
	</body>
</html>