From 257021b1af4f5414fb71ada695d86bd51bb5dc04 Mon Sep 17 00:00:00 2001 From: Scott González Date: Fri, 12 Aug 2011 23:11:35 -0400 Subject: Spinner: Fixed precision when stepping. Thanks hughlomas --- tests/unit/spinner/spinner_core.js | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'tests/unit') diff --git a/tests/unit/spinner/spinner_core.js b/tests/unit/spinner/spinner_core.js index 55b806a7f..1c2b7ae17 100644 --- a/tests/unit/spinner/spinner_core.js +++ b/tests/unit/spinner/spinner_core.js @@ -185,4 +185,21 @@ test( "focus text field when pressing button", function() { ok( element[ 0 ] === document.activeElement, "focused after" ); }); +test( "precision", function() { + expect( 2 ); + var element = $( "#spin" ).spinner({ + value: .05, + step: .0001 + }); + element.spinner( "stepUp" ); + equal( element.val(), "0.0501", "precision from step" ); + + element.spinner( "option", { + value: 1.05, + step: 1 + }); + element.spinner( "stepDown" ); + equal( element.val(), "0.05", "precision from value" ); +}); + })( jQuery ); -- cgit v1.2.3