aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorChi Cheng <cloudream@gmail.com>2008-08-19 05:54:49 +0000
committerChi Cheng <cloudream@gmail.com>2008-08-19 05:54:49 +0000
commit1f6a9c9eda1cf26838cf3e7edf14830c7311ad1e (patch)
tree1de719e869eae1d41a6d858ee7c26d528e9ccf55 /tests
parentf50d9f0a954db2c4e17380d16273388910188590 (diff)
downloadjquery-ui-1f6a9c9eda1cf26838cf3e7edf14830c7311ad1e.tar.gz
jquery-ui-1f6a9c9eda1cf26838cf3e7edf14830c7311ad1e.zip
Spinner test: spin with auto-incremental stepping
Diffstat (limited to 'tests')
-rw-r--r--tests/all.html14
-rw-r--r--tests/spinner.js23
2 files changed, 37 insertions, 0 deletions
diff --git a/tests/all.html b/tests/all.html
index e5f85a27c..0080e86f9 100644
--- a/tests/all.html
+++ b/tests/all.html
@@ -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> \ No newline at end of file
diff --git a/tests/spinner.js b/tests/spinner.js
index ca664b2e2..4c0bf2b14 100644
--- a/tests/spinner.js
+++ b/tests/spinner.js
@@ -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();