Spinner test: spin with auto-incremental stepping

This commit is contained in:
Chi Cheng 2008-08-19 05:54:49 +00:00
parent f50d9f0a95
commit 1f6a9c9eda
2 changed files with 37 additions and 0 deletions

View File

@ -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,12 +16,14 @@
<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>
@ -28,8 +31,10 @@
<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 @@
<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 @@
<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>

View File

@ -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();