Skip to content

Commit d4bdd19

Browse files
committed
effects.test: adding a test for size using toggle
1 parent c73e40a commit d4bdd19

File tree

2 files changed

+22
-7
lines changed

2 files changed

+22
-7
lines changed

tests/visual/effects.all.html

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,13 @@
147147

148148
<li>
149149
<div class="effect" id="size">
150-
<p>Size</p>
150+
<p>Size Default Show/Hide</p>
151+
</div>
152+
</li>
153+
154+
<li>
155+
<div class="effect" id="sizeToggle">
156+
<p>Size Toggle</p>
151157
</div>
152158
</li>
153159

tests/visual/effects.all.js

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,10 @@ $(function() {
2828
var el = $(this);
2929
el.addClass("current").hide(duration, function() {
3030
setTimeout(function() {
31-
el.show(duration, function() { el.removeClass("current") });
31+
el.show(duration, function() { el.removeClass("current"); });
3232
}, wait);
33-
})
34-
})
33+
});
34+
});
3535

3636
effect("#blindLeft", "blind", { direction: "left" });
3737
effect("#blindUp", "blind", { direction: "up" });
@@ -61,7 +61,16 @@ $(function() {
6161

6262
effect("#puff", "puff", { times: 2 });
6363
effect("#scale", "scale", {});
64-
effect("#size", "size", { from: { width: 300, height: 300 }});
64+
effect("#size", "size", {});
65+
$("#sizeToggle").bind("click", function() {
66+
var opts = { to: { width: 300, height: 300 }};
67+
$(this).addClass('current')
68+
.toggle("size", opts, duration)
69+
.delay(wait)
70+
.toggle("size", opts, duration, function() {
71+
$(this).removeClass("current");
72+
});
73+
});
6574

6675
$("#shake").bind("click", function() { $(this).addClass("current").effect("shake", {}, 100, function() { $(this).removeClass("current"); }); });
6776

@@ -83,13 +92,13 @@ $(function() {
8392
$("#removeClass").click(function() {
8493
$(this).addClass("current").removeClass(function() {
8594
window.console && console.log(arguments);
86-
return "current"
95+
return "current";
8796
}, duration);
8897
});
8998
$("#toggleClass").click(function() {
9099
$(this).toggleClass(function() {
91100
window.console && console.log(arguments);
92-
return "current"
101+
return "current";
93102
}, duration);
94103
});
95104
});

0 commit comments

Comments
 (0)