Skip to content

Commit ba1776a

Browse files
committed
Position: Cleanup visual tests, keep general and feedback
1 parent c549864 commit ba1776a

File tree

8 files changed

+188
-743
lines changed

8 files changed

+188
-743
lines changed

tests/visual/index.html

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -51,12 +51,6 @@ <h2>Position</h2>
5151
<ul>
5252
<li><a href="position/position.html">General</a></li>
5353
<li><a href="position/position_feedback.html">Feedback</a></li>
54-
<li><a href="position/position_feedback_rotate.html">Feedback (rotate)</a></li>
55-
<li><a href="position/position_fit.html">Collision - fit</a></li>
56-
<li><a href="position/position_flip.html">Collision - flip</a></li>
57-
<li><a href="position/position_flipfit.html">Collision - flipfit</a></li>
58-
<li><a href="position/position_margin.html">Margins</a></li>
59-
<li><a href="position/position_within.html">Within</a></li>
6054
</ul>
6155

6256
<h2>Tooltip</h2>

tests/visual/position/position.html

Lines changed: 188 additions & 78 deletions
Original file line numberDiff line numberDiff line change
@@ -1,91 +1,201 @@
1-
<!DOCTYPE html>
1+
<!doctype html>
22
<html lang="en">
33
<head>
4-
<meta charset="UTF-8" />
5-
<title>Position Visual Test: Default</title>
6-
<link rel="stylesheet" href="../visual.css" type="text/css" />
7-
<link rel="stylesheet" href="../../../themes/base/jquery.ui.all.css" type="text/css" title="ui-theme" />
8-
<script type="text/javascript" src="../../../jquery-1.7.2.js"></script>
9-
<script type="text/javascript" src="../../../ui/jquery.ui.core.js"></script>
10-
<script type="text/javascript" src="../../../ui/jquery.ui.widget.js"></script>
11-
<script type="text/javascript" src="../../../ui/jquery.ui.position.js"></script>
12-
<script type="text/javascript" src="../../../ui/jquery.ui.menu.js"></script>
13-
<script type="text/javascript">
14-
$(function() {
15-
var inputs = $("input");
16-
$("ul").insertAfter(inputs);
17-
$(window).resize(function() {
18-
inputs.each(function() {
19-
var input = $(this).position({
20-
my: this.id.replace(/-/, " "),
21-
at: this.id.replace(/-/, " "),
22-
of: "#container",
23-
collision: "none"
24-
});
25-
var menu = $(this).next().menu()
26-
menu.position({
27-
my: "left+30 top+20",
28-
at: "left bottom",
29-
of: this,
30-
using: function( position, feedback ) {
31-
input.val(feedback.horizontal + " " + feedback.vertical)
32-
$(this).offset( position );
33-
$(this)
34-
.removeClass("left right top bottom center middle")
35-
.addClass(feedback.horizontal)
36-
.addClass(feedback.vertical);
37-
}
38-
});
39-
});
40-
}).resize();
41-
});
42-
</script>
4+
<meta charset="utf-8">
5+
<title>Position Visual Test: Containing Element</title>
6+
7+
<link rel="stylesheet" href="../visual.css" type="text/css" />
8+
<link rel="stylesheet" href="../../../themes/base/jquery.ui.all.css" type="text/css" title="ui-theme" />
9+
10+
<script src="../../../jquery-1.7.2.js"></script>
11+
<script src="../../../ui/jquery.ui.core.js"></script>
12+
<script src="../../../ui/jquery.ui.widget.js"></script>
13+
<script src="../../../ui/jquery.ui.mouse.js"></script>
14+
<script src="../../../ui/jquery.ui.draggable.js"></script>
15+
<script src="../../../ui/jquery.ui.position.js"></script>
16+
4317
<style>
44-
input, .ui-menu { position: absolute; }
45-
.ui-menu { width: 200px; }
46-
html, body { width: 99%; height: 99%; min-height:700px; min-width:700px; }
47-
#container { width: 95%; height: 95%; border: 1px solid black; margin: auto; }
48-
.ui-menu:before {
49-
font-size: 12pt;
50-
content: "↑";
51-
position: absolute;
52-
top: -22px;
53-
left: 5px;
18+
html, body {
19+
height:100%;
20+
width:100%;
21+
margin:0;
22+
/* force scroll bar*/
23+
min-height:800px;
24+
min-width:800px;
25+
26+
/* IE6 needs this */
27+
text-align:center;
28+
}
29+
.demo-description {
30+
text-align:center;
31+
padding:1.5em;
32+
}
33+
.demo-container {
34+
background:#aaa;
35+
width:80%;
36+
height:80%;
37+
38+
text-align:left;
39+
margin:0 auto;
40+
position:relative;
41+
padding:10px;
42+
}
43+
.demo {
44+
background:#eee;
45+
overflow:hidden;
46+
position:relative;
47+
height:100%;
48+
/* IE6 needs this */
49+
width:100%;
50+
}
51+
#parent {
52+
width: 60%;
53+
margin: 10px auto;
54+
padding: 5px;
55+
border: 1px solid #777;
56+
background-color: #fbca93;
57+
text-align: center;
58+
cursor:move;
59+
}
60+
.positionable {
61+
width: 75px;
62+
height: 75px;
63+
position: absolute;
64+
display: block;
65+
right: 0;
66+
bottom: 0;
67+
background-color: #bcd5e6;
68+
text-align: center;
69+
cursor:move;
70+
}
71+
.ui-flipped-top {
72+
border-top: 3px solid #000000;
73+
}
74+
.ui-flipped-bottom {
75+
border-bottom: 3px solid #000000;
5476
}
55-
.right:before {
56-
left: auto;
57-
right: 5px;
77+
.ui-flipped-left {
78+
border-left: 3px solid #000000;
5879
}
59-
.bottom:before {
60-
content: "↓";
61-
top: auto;
62-
bottom: -19px;
80+
.ui-flipped-right {
81+
border-right: 3px solid #000000;
6382
}
83+
select, input {
84+
margin-left: 15px;
85+
}
86+
.extra-margin {
87+
margin: 0 15px 15px 0;
88+
}
6489
</style>
90+
<script>
91+
$(function() {
92+
var within = $( ".demo" ),
93+
positionable = $( ".positionable" );
94+
function position() {
95+
positionable.position({
96+
of: $( "#parent" ),
97+
my: $( "#my_horizontal" ).val() + " " + $( "#my_vertical" ).val(),
98+
at: $( "#at_horizontal" ).val() + " " + $( "#at_vertical" ).val(),
99+
offset: $( "#offset" ).val(),
100+
within: within,
101+
collision: $( "#collision_horizontal" ).val() + " " + $( "#collision_vertical" ).val()
102+
});
103+
}
104+
$( ".demo" ).css("overflow","scroll");
105+
106+
positionable.css( "opacity", 0.5 );
107+
108+
109+
$( "#parent" ).draggable({
110+
drag: function() { position(); }
111+
});
112+
113+
$("#within").click(function() {
114+
within = within.is(".demo") ? $(window) : $(".demo");
115+
position();
116+
});
117+
118+
$("#margin").click(function() {
119+
positionable.toggleClass( "extra-margin" );
120+
position();
121+
});
122+
123+
$( ":input" ).bind( "click keyup change", function() { position(); } );
124+
125+
position();
126+
});
127+
</script>
65128
</head>
66129
<body>
67130

68-
<div id="container"></div>
69-
70-
<input id="left-top" />
71-
<input id="left-center" />
72-
<input id="left-bottom" />
73-
<input id="center-top" />
74-
<input id="center-center" />
75-
<input id="center-bottom" />
76-
<input id="right-top" />
77-
<input id="right-center" />
78-
<input id="right-bottom" />
79-
80-
<ul>
81-
<li><a href="#">Java</a></li>
82-
<li><a href="#">JavaScript</a></li>
83-
<li><a href="#">Perl</a></li>
84-
<li><a href="#">Ruby</a></li>
85-
<li><a href="#">C++</a></li>
86-
<li><a href="#">Python</a></li>
87-
<li><a href="#">C#</a></li>
88-
</ul>
131+
<div class="demo-container">
132+
<div class="demo">
133+
134+
<div id="parent">
135+
<p>This is the position parent element.</p>
136+
</div>
137+
138+
<div class="positionable">
139+
<p>to position</p>
140+
</div>
141+
142+
<div class="positionable" style="width:120px; height: 40px;">
143+
<p>to position 2</p>
144+
</div>
145+
146+
<form style="padding: 20px; margin-top: 75px;">
147+
<h2>Position configuration:
148+
<div style="padding-bottom: 20px;">
149+
<b>my:</b>
150+
<select id="my_horizontal">
151+
<option value="left">left</option>
152+
<option value="center">center</option>
153+
<option value="right" selected="selected">right</option>
154+
</select>
155+
<select id="my_vertical">
156+
<option value="top">top</option>
157+
<option value="middle">center</option>
158+
<option value="bottom">bottom</option>
159+
</select>
160+
</div>
161+
<div style="padding-bottom: 20px;">
162+
<b>at:</b>
163+
<select id="at_horizontal">
164+
<option value="left">left</option>
165+
<option value="center">center</option>
166+
<option value="right" selected="selected">right</option>
167+
</select>
168+
<select id="at_vertical">
169+
<option value="top">top</option>
170+
<option value="middle">center</option>
171+
<option value="bottom">bottom</option>
172+
</select>
173+
</div>
174+
<div style="padding-bottom: 20px;">
175+
<b>collision:</b>
176+
<select id="collision_horizontal">
177+
<option value="flip">flip</option>
178+
<option value="fit">fit</option>
179+
<option value="none">none</option>
180+
</select>
181+
<select id="collision_vertical">
182+
<option value="flip">flip</option>
183+
<option value="fit">fit</option>
184+
<option value="none">none</option>
185+
</select>
186+
</div>
187+
<div>
188+
<label for="within">within:</label>
189+
<input id="within" type="checkbox" checked />
190+
</div>
191+
<div>
192+
<label for="margin">extra margin:</label>
193+
<input id="margin" type="checkbox" />
194+
</div>
195+
</form>
196+
197+
</div><!-- End demo -->
198+
</div>
89199

90200
</body>
91201
</html>

0 commit comments

Comments
 (0)