mirror of
https://github.com/jquery/jquery-ui.git
synced 2025-01-07 20:34:24 +00:00
Spinner: added a timer to mousewheel interaction which fires a change event when the mousewheel stops spinning.
Added a few missing options to test case.
This commit is contained in:
parent
b920e5893a
commit
24afc68d5b
@ -56,7 +56,7 @@ test("enable", function() {
|
||||
});
|
||||
|
||||
test("defaults", function() {
|
||||
expect(7);
|
||||
expect(10);
|
||||
el = $("#spin").spinner();
|
||||
|
||||
equals(el.data("currency.spinner"), false, "currency");
|
||||
@ -66,6 +66,9 @@ test("defaults", function() {
|
||||
equals(el.data("min.spinner"), undefined, "min");
|
||||
equals(el.data("start.spinner"), 0, "start");
|
||||
equals(el.data("stepping.spinner"), 1, "stepping");
|
||||
equals(el.data("decimals.spinner"), 0, "decimals");
|
||||
equals(el.data("format.spinner"), '%', "format");
|
||||
equals(el.data("items.spinner"), false, "items");
|
||||
|
||||
});
|
||||
|
||||
@ -261,7 +264,6 @@ test("mouse click on buttons", function() {
|
||||
|
||||
equals(el.val(), 0, "mouse double click to down");
|
||||
|
||||
|
||||
});
|
||||
|
||||
test("callback", function() {
|
||||
|
@ -6,6 +6,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.spinner.js"></script>
|
||||
<script type="text/javascript" src="../../jquery.mousewheel.js"></script>
|
||||
|
||||
|
||||
<script type="text/javascript">
|
||||
|
@ -263,8 +263,14 @@ $.widget('ui.spinner', {
|
||||
(/[0-9\-\.]/).test(String.fromCharCode(e.keyCode))) ? true : false;
|
||||
},
|
||||
_mousewheel: function(e, delta) {
|
||||
var self = this;
|
||||
delta = ($.browser.opera ? -delta / Math.abs(delta) : delta);
|
||||
(delta > 0 ? this._up(e) : this._down(e));
|
||||
(delta > 0 ? self._up(e) : self._down(e));
|
||||
if (self.timeout) {
|
||||
window.clearTimeout(self.timeout);
|
||||
self.timeout = 0;
|
||||
}
|
||||
self.timeout = window.setTimeout(function(){self._propagate('change', e)}, 500);
|
||||
e.preventDefault();
|
||||
},
|
||||
_getValue: function() {
|
||||
|
Loading…
Reference in New Issue
Block a user