Debian Codegraph @

dijit/tests/place-margin.html

raw symbols SCIP
1 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
2 "http://www.w3.org/TR/html4/strict.dtd">
3 <html>
4 <head>
5 <title>dijit/place with margin on body unit test</title>
6
7 <script src="boilerplate.js"></script>
8
9 <style type="text/css">
10 html {
11 overflow: hidden; /* ie6 needs this */
12 }
13 body {
14 height: 100%;
15 padding: 0;
16 border: 0;
17
18 /* testing for margin on <body>, see #16148 */
19 position: relative;
20 top: 0;
21 margin-top: 40px;
22 margin-left: 10px;
23 margin-right: 20px;
24 }
25
26 .aroundNode {
27 position: absolute;
28 width: 20px;
29 height: 20px;
30 background: yellow;
31 }
32
33 #popup {
34 position: absolute;
35 width: 75px;
36 background: blue;
37 color: white;
38 }
39 </style>
40
41 <script type="text/javascript">
42 require([
43 "doh/runner",
44 "dojo/dom", "dojo/dom-geometry", "dojo/window",
45 "dijit/place", "dojo/domReady!"
46 ], function(doh, dom, domGeometry, winUtils, place){
47
48 // The around nodes
49 var aroundTop = dom.byId("aroundTop"),
50 aroundLeft = dom.byId("aroundLeft"),
51 aroundRight = dom.byId("aroundRight");
52
53 // The popup (aka dropdown)
54 var popup = dom.byId("popup");
55
56 doh.register("around with body margin", [
57 function aroundT(t){
58 // Dropdown from "aroundTop" node.
59 var ret = place.around(popup, aroundTop, [
60 "below" // aroundTop's bottom-left corner with the popup's top-left corner
61 ], true);
62
63 doh.is("20px", popup.style.top, "underneath around node");
64 },
65 function aroundL(t){
66 // middle left popup from "aroundLeft" node
67 var ret = place.around(popup, aroundLeft, [
68 "after-centered" // aroundLeft's middle-right with the popup's middle-left
69 ], true);
70
71 var popupPos = domGeometry.position(popup);
72 var aroundPos = domGeometry.position(aroundLeft);
73 doh.is(Math.round(aroundPos.x + aroundPos.w), Math.round(popupPos.x), "after around node");
74 },
75 function aroundR(t){
76 // This will put the drop-down to the left of the "aroundRight" node
77 var ret = place.around(popup, aroundRight, ["before-centered"], true);
78
79 var popupPos = domGeometry.position(popup);
80 var aroundPos = domGeometry.position(aroundRight);
81 doh.is(Math.round(popupPos.x + popupPos.w), Math.round(aroundPos.x),
82 "right aligned with around node");
83 }
84 ]);
85
86 doh.run();
87 });
88
89 </script>
90 </head>
91 <body style="position: relative; top: 0; margin-top: 40px;">
92 <h1>Dijit Place With Margin On BODY Unit Test</h1>
93 <div id="aroundTop" class="aroundNode" style="top: 0px; left: 50%">T</div>
94 <div id="aroundLeft" class="aroundNode" style="bottom: 30%; left: 0px;">L</div>
95 <div id="aroundRight" class="aroundNode" style="bottom: 30%; right: 0px;">R</div>
96
97 <div id="popup">
98 I'm a drop down, wider and taller than the around nodes I'm placed next to.
99 </div>
100 <div style="height: 200px">
101 <!-- spacer -->
102 </div>
103 </body>
104 </html>