Skip to content

Commit be9e087

Browse files
mikesherovarschmitz
authored andcommitted
Effects Tests: Fix and format scale visual test
1 parent 38ab832 commit be9e087

File tree

1 file changed

+23
-12
lines changed

1 file changed

+23
-12
lines changed

tests/visual/effects/scale.html

+23-12
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,14 @@
77
<script src="../../../external/jquery/jquery.js"></script>
88
<script src="../../../ui/effect.js"></script>
99
<script src="../../../ui/effect-scale.js"></script>
10+
<script src="../../../ui/effect-size.js"></script>
1011
<script>
1112
$(function() {
1213
var test = $( "#testBox" ),
1314
opts = $( ".arg" ),
1415
optsRev = $( opts.get().reverse() ),
1516
doer = $( "#doAnim" ),
1617
current = $( "#current" ),
17-
cleanStyle = test[0].style,
1818
total = 1;
1919

2020
opts.each(function() {
@@ -34,45 +34,50 @@
3434
optsRev.each(function() {
3535
var cur = this.selectedIndex,
3636
next = cur + direction,
37-
len = this.options.length;
37+
len = this.options.length,
38+
newIndex = ( next + len ) % len;
3839

39-
this.selectedIndex = ( next + len ) % len;
40+
this.selectedIndex = newIndex;
4041

41-
if ( ( next+len ) % len === next ) return false;
42+
if ( newIndex === next ) {
43+
return false;
44+
}
4245
});
4346
doAnim();
4447
}
4548

46-
4749
function doAnim() {
4850
var cur = 0;
4951
opts.each(function() {
50-
cur *= this.options.length
52+
cur *= this.options.length;
5153
cur += this.selectedIndex;
5254
});
5355
cur++;
5456
current.text( "Configuration: " + cur + " of " + total );
55-
run.apply(test, opts.map(function() {
56-
return $(this).val();
57-
}).get());
57+
run.apply( test, opts.map(function() {
58+
return $( this ).val();
59+
}).get() );
5860
}
5961

6062
function run( position, v, h, vo, ho ) {
6163
var el = this,
62-
style = el[0].style,
64+
style = el[ 0 ].style,
6365
effect = {
6466
effect: "scale",
6567
mode: "effect",
6668
percent: 200,
6769
origin: [ vo, ho ],
6870
duration: 500
6971
};
70-
el.stop(true, true);
72+
73+
el.stop( true, true );
74+
7175
if ( typeof style === "object" ) {
7276
style.cssText = "";
7377
} else {
74-
el[0].style = "";
78+
el[ 0 ].style = "";
7579
}
80+
7681
el.css( "position", position )
7782
.css( h, 5 )
7883
.css( v, 5 )
@@ -95,6 +100,9 @@
95100
border: 10px solid #fff;
96101
margin: 10px;
97102
padding: 10px;
103+
position: absolute;
104+
left: 5px;
105+
top: 5px;
98106
}
99107
label {
100108
display: block;
@@ -111,6 +119,7 @@
111119
</style>
112120
</head>
113121
<body>
122+
114123
<div id="testArea">
115124
<div id="testBox">
116125
</div>
@@ -154,4 +163,6 @@
154163
<button id="doAnim">Run Animation</button>
155164
<button id="cycleNext">Forward</button>
156165
</div>
166+
157167
</body>
168+
</html>

0 commit comments

Comments
 (0)