Skip to content

Commit 75f6b5f

Browse files
committed
Position visual tests: Cleanup.
1 parent cac6831 commit 75f6b5f

File tree

2 files changed

+120
-178
lines changed

2 files changed

+120
-178
lines changed

tests/visual/position/position.html

Lines changed: 118 additions & 176 deletions
Original file line numberDiff line numberDiff line change
@@ -1,200 +1,142 @@
11
<!doctype html>
22
<html lang="en">
33
<head>
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-
4+
<meta charset="utf-8">
5+
<title>Position Visual Test</title>
106
<script src="../../../jquery-1.7.2.js"></script>
117
<script src="../../../ui/jquery.ui.core.js"></script>
128
<script src="../../../ui/jquery.ui.widget.js"></script>
139
<script src="../../../ui/jquery.ui.mouse.js"></script>
1410
<script src="../../../ui/jquery.ui.draggable.js"></script>
1511
<script src="../../../ui/jquery.ui.position.js"></script>
16-
1712
<style>
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;
13+
.demo {
14+
position: relative;
15+
height: 500px;
16+
width: 80%;
17+
margin: 20px auto;
18+
background: #eee;
7319
}
74-
.ui-flipped-bottom {
75-
border-bottom: 3px solid #000000;
20+
#target {
21+
width: 60%;
22+
margin: 0 auto;
23+
border: 1px solid #777;
24+
background-color: #fbca93;
25+
text-align: center;
26+
cursor: move;
7627
}
77-
.ui-flipped-left {
78-
border-left: 3px solid #000000;
28+
.positionable {
29+
position: absolute;
30+
background-color: #bcd5e6;
31+
text-align: center;
7932
}
80-
.ui-flipped-right {
81-
border-right: 3px solid #000000;
33+
.extra-margin {
34+
margin: 0 15px 15px 0;
8235
}
83-
select, input {
84-
margin-left: 15px;
85-
}
86-
.extra-margin {
87-
margin: 0 15px 15px 0;
88-
}
8936
</style>
9037
<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-
});
38+
$(function() {
39+
var within = $( ".demo" ),
40+
positionable = $( ".positionable" );
41+
function position() {
42+
positionable.position({
43+
of: $( "#target" ),
44+
my: $( "#my_horizontal" ).val() + " " + $( "#my_vertical" ).val(),
45+
at: $( "#at_horizontal" ).val() + " " + $( "#at_vertical" ).val(),
46+
within: within,
47+
collision: $( "#collision_horizontal" ).val() + " " + $( "#collision_vertical" ).val()
48+
});
49+
}
50+
51+
positionable.css( "opacity", 0.5 );
52+
53+
$( "#target" ).draggable({
54+
drag: function() { position(); }
55+
});
56+
57+
$( "#within" ).click(function() {
58+
within = within.is( ".demo" ) ? $( window ) : $( ".demo" );
59+
position();
60+
});
61+
62+
$( "#margin" ).click(function() {
63+
positionable.toggleClass( "extra-margin" );
64+
position();
65+
});
66+
67+
$( ":input" ).bind( "click keyup change", function() { position(); } );
68+
69+
position();
70+
});
12771
</script>
12872
</head>
12973
<body>
13074

131-
<div class="demo-container">
13275
<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 -->
76+
<div id="target">
77+
<p>This is the position target element.</p>
78+
</div>
79+
80+
<div class="positionable" style="width: 75px; height: 75px;">
81+
<p>to position</p>
82+
</div>
83+
84+
<div class="positionable" style="width:120px; height: 40px;">
85+
<p>to position 2</p>
86+
</div>
87+
88+
<form style="padding: 20px; margin-top: 75px;">
89+
<h2>Position configuration:</h2>
90+
<div style="padding-bottom: 20px;">
91+
<b>my:</b>
92+
<select id="my_horizontal">
93+
<option value="left">left</option>
94+
<option value="center">center</option>
95+
<option value="right" selected="selected">right</option>
96+
</select>
97+
<select id="my_vertical">
98+
<option value="top">top</option>
99+
<option value="middle">center</option>
100+
<option value="bottom">bottom</option>
101+
</select>
102+
</div>
103+
<div style="padding-bottom: 20px;">
104+
<b>at:</b>
105+
<select id="at_horizontal">
106+
<option value="left">left</option>
107+
<option value="center">center</option>
108+
<option value="right" selected="selected">right</option>
109+
</select>
110+
<select id="at_vertical">
111+
<option value="top">top</option>
112+
<option value="middle">center</option>
113+
<option value="bottom">bottom</option>
114+
</select>
115+
</div>
116+
<div style="padding-bottom: 20px;">
117+
<b>collision:</b>
118+
<select id="collision_horizontal">
119+
<option value="flip">flip</option>
120+
<option value="fit">fit</option>
121+
<option value="flipfit">flipfit</option>
122+
<option value="none">none</option>
123+
</select>
124+
<select id="collision_vertical">
125+
<option value="flip">flip</option>
126+
<option value="fit">fit</option>
127+
<option value="flipfit">flipfit</option>
128+
<option value="none">none</option>
129+
</select>
130+
</div>
131+
<div>
132+
<label for="within">within:</label>
133+
<input id="within" type="checkbox" checked="checked">
134+
</div>
135+
<div>
136+
<label for="margin">extra margin:</label>
137+
<input id="margin" type="checkbox">
138+
</div>
139+
</form>
198140
</div>
199141

200142
</body>

tests/visual/position/position_feedback.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,7 @@
22
<html lang="en">
33
<head>
44
<meta charset="utf-8">
5-
<title>Position Visual Test: Default</title>
6-
<link rel="stylesheet" href="../visual.css">
5+
<title>Position Visual Test: Feedback</title>
76
<link rel="stylesheet" href="../../../themes/base/jquery.ui.all.css">
87
<script src="../../../jquery-1.7.2.js"></script>
98
<script src="../../../ui/jquery.ui.core.js"></script>
@@ -86,6 +85,7 @@
8685
width: 75px;
8786
height: 25px;
8887
padding: 5px;
88+
font-size: 62.5%;
8989
}
9090
#target {
9191
height: 75px;

0 commit comments

Comments
 (0)