Skip to content
Permalink
Browse files

Spinner test: spin with auto-incremental stepping

  • Loading branch information
chicheng committed Aug 19, 2008
1 parent f50d9f0 commit 1f6a9c9eda1cf26838cf3e7edf14830c7311ad1e
Showing with 37 additions and 0 deletions.
  1. +14 −0 tests/all.html
  2. +23 −0 tests/spinner.js
@@ -7,6 +7,7 @@
<script type="text/javascript" src="../jquery-1.2.6.js"></script>
<script type="text/javascript" src="../ui/ui.core.js"></script>
<script type="text/javascript" src="../ui/ui.accordion.js"></script>
<script type="text/javascript" src="../ui/ui.autocomplete.js"></script>
<script type="text/javascript" src="../ui/ui.datepicker.js"></script>
<script type="text/javascript" src="../ui/ui.dialog.js"></script>
<script type="text/javascript" src="../ui/ui.draggable.js"></script>
@@ -15,21 +16,25 @@
<script type="text/javascript" src="../ui/ui.selectable.js"></script>
<script type="text/javascript" src="../ui/ui.slider.js"></script>
<script type="text/javascript" src="../ui/ui.sortable.js"></script>
<script type="text/javascript" src="../ui/ui.spinner.js"></script>
<script type="text/javascript" src="../ui/ui.tabs.js"></script>

<script type="text/javascript" src="qunit/testrunner.js"></script>
<script type="text/javascript" src="simulate/jquery.simulate.js"></script>

<script type="text/javascript" src="accordion.js"></script>
<script type="text/javascript" src="autocomplete.js"></script>
<script type="text/javascript" src="datepicker.js"></script>
<script type="text/javascript" src="dialog.js"></script>
<script type="text/javascript" src="draggable.js"></script>
<script type="text/javascript" src="resizable.js"></script>
<script type="text/javascript" src="selectable.js"></script>
<script type="text/javascript" src="slider.js"></script>
<script type="text/javascript" src="sortable.js"></script>
<script type="text/javascript" src="spinner.js"></script>

<style type="text/css">
@import "../themes/flora/flora.datepicker.css";
.xerror, .error { display: none }
</style>

@@ -42,12 +47,15 @@ <h2 id="userAgent"></h2>
<h4>Run individual testsuites or doubleclick a test below</h4>
<ul>
<li><a href="accordion.html">Accordion</a></li>
<li><a href="autocomplete.html">Autocomplete</a></li>
<li><a href="datepicker.html">Datepicker</a></li>
<li><a href="dialog.html">Dialog</a></li>
<li><a href="draggable.html">Draggable</a></li>
<li><a href="resizable.html">Resizable</a></li>
<li><a href="selectable.html">Selectable</a></li>
<li><a href="slider.html">Slider</a></li>
<li><a href="sortable.html">Sortable</a></li>
<li><a href="spinner.html">Spinner</a></li>
</ul>

<ol id="tests"></ol>
@@ -186,6 +194,12 @@ <h4>Run individual testsuites or doubleclick a test below</h4>
<li>Item 5</li>
</ul>

<p><input type="text" id="inp"/><input type="text" id="alt"/><div id="inl"></div></p>

<input type="text" name="autocomplete" value="" id="autocomplete">

<input type="text" id="spin" />

</div>
</body>
</html>
@@ -104,6 +104,29 @@ test("keydown on input with options", function() {

});

test("spin with auto-incremental stepping", function() {
expect(2);

el = $("#spin").spinner();

for ( var i = 1 ; i<=120 ; i++ ) {
el.simulate("keydown",{keyCode:$.simulate.VK_UP});
}

el.simulate("keyup",{keyCode:$.simulate.VK_UP});

equals(el.val(), 300, "keydown 120 times");

for ( var i = 1 ; i<=130 ; i++ ) {
el.simulate("keydown",{keyCode:$.simulate.VK_DOWN});
}

el.simulate("keyup",{keyCode:$.simulate.VK_DOWN});

equals(el.val(), -100, "keydown 130 times");

});

test("mouse click on buttons", function() {
expect(4);
el = $("#spin").spinner();

0 comments on commit 1f6a9c9

Please sign in to comment.
You can’t perform that action at this time.