From 04e5b103ca81e630bab5e072f805ef4a3fe489c9 Mon Sep 17 00:00:00 2001 From: Scott González Date: Wed, 28 Sep 2011 09:32:11 -0400 Subject: Tooltip: Fixed defaults in tests. --- tests/unit/tooltip/tooltip_defaults.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'tests') diff --git a/tests/unit/tooltip/tooltip_defaults.js b/tests/unit/tooltip/tooltip_defaults.js index 4b687bdcb..b8b41bf47 100644 --- a/tests/unit/tooltip/tooltip_defaults.js +++ b/tests/unit/tooltip/tooltip_defaults.js @@ -7,7 +7,7 @@ commonWidgetTests( "tooltip", { position: { my: "left+15 center", at: "right center", - collision: "flip fit" + collision: "flipfit flipfit" }, show: true, tooltipClass: null, -- cgit v1.2.3 From 39b452e1be8d6ef9006c26be3495c633d15ff96f Mon Sep 17 00:00:00 2001 From: Scott González Date: Wed, 28 Sep 2011 10:00:25 -0400 Subject: Effects tests: Ignore leading/trailing whitespace when comparing style properties. --- tests/unit/effects/effects_core.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'tests') diff --git a/tests/unit/effects/effects_core.js b/tests/unit/effects/effects_core.js index 2b4d684eb..1e5da2113 100644 --- a/tests/unit/effects/effects_core.js +++ b/tests/unit/effects/effects_core.js @@ -143,10 +143,10 @@ asyncTest( "animateClass clears style properties when stopped", function() { expect( 2 ); test.addClass( "testChangeBackground", duration ); - notEqual( orig, style.cssText, "cssText is the not the same after starting animation" ); + notEqual( orig, style.cssText, "cssText is not the same after starting animation" ); test.stop( true, true ); - equal( orig, style.cssText, "cssText is the same after stopping animation midway" ); + equal( orig, $.trim( style.cssText ), "cssText is the same after stopping animation midway" ); start(); }); -- cgit v1.2.3 From c2f036277c6190bc8677bc0eac53c22ed5e8a08d Mon Sep 17 00:00:00 2001 From: Scott González Date: Wed, 28 Sep 2011 18:30:58 -0400 Subject: Spinner: Added culture option. --- tests/unit/spinner/spinner.html | 1 + tests/unit/spinner/spinner_defaults.js | 1 + tests/unit/spinner/spinner_options.js | 25 +++++++++++++++++++++++++ ui/jquery.ui.spinner.js | 6 ++++-- 4 files changed, 31 insertions(+), 2 deletions(-) (limited to 'tests') diff --git a/tests/unit/spinner/spinner.html b/tests/unit/spinner/spinner.html index ddfb03d91..321c16b4c 100644 --- a/tests/unit/spinner/spinner.html +++ b/tests/unit/spinner/spinner.html @@ -9,6 +9,7 @@ + diff --git a/tests/unit/spinner/spinner_defaults.js b/tests/unit/spinner/spinner_defaults.js index 3321f8733..0a4e7c236 100644 --- a/tests/unit/spinner/spinner_defaults.js +++ b/tests/unit/spinner/spinner_defaults.js @@ -1,5 +1,6 @@ commonWidgetTests( "spinner", { defaults: { + culture: null, disabled: false, incremental: true, max: null, diff --git a/tests/unit/spinner/spinner_options.js b/tests/unit/spinner/spinner_options.js index 2b557cb69..8be57c785 100644 --- a/tests/unit/spinner/spinner_options.js +++ b/tests/unit/spinner/spinner_options.js @@ -2,6 +2,8 @@ module( "spinner: options" ); +// culture is tested after numberFormat, since it depends on numberFormat + test( "incremental, false", function() { expect( 100 ); @@ -91,6 +93,29 @@ test( "numberFormat, currency", function() { equal( element.val(), "$1.00", "formatted after step" ); }); +test( "culture, null", function() { + expect( 2 ); + Globalize.culture( "ja-JP" ); + var element = $( "#spin" ).val( 0 ).spinner({ numberFormat: "C" }); + equal( element.val(), "¥0", "formatted on init" ); + element.spinner( "stepUp" ); + equal( element.val(), "¥1", "formatted after step" ); + + // reset culture + Globalize.culture( "default" ); +}); + +test( "currency, ja-JP", function() { + expect( 2 ); + var element = $( "#spin" ).val( 0 ).spinner({ + numberFormat: "C", + culture: "ja-JP" + }); + equal( element.val(), "¥0", "formatted on init" ); + element.spinner( "stepUp" ); + equal( element.val(), "¥1", "formatted after step" ); +}); + test( "max", function() { expect( 3 ); var element = $( "#spin" ).val( 1000 ).spinner({ max: 100 }); diff --git a/ui/jquery.ui.spinner.js b/ui/jquery.ui.spinner.js index 09df97be7..31de2c9da 100644 --- a/ui/jquery.ui.spinner.js +++ b/ui/jquery.ui.spinner.js @@ -30,6 +30,7 @@ $.widget( "ui.spinner", { defaultElement: "", widgetEventPrefix: "spin", options: { + culture: null, incremental: true, max: null, min: null, @@ -320,7 +321,8 @@ $.widget( "ui.spinner", { _parse: function( val ) { if ( typeof val === "string" && val !== "" ) { - val = window.Globalize && this.options.numberFormat ? Globalize.parseFloat( val ) : +val; + val = window.Globalize && this.options.numberFormat ? + Globalize.parseFloat( val, 10, this.options.culture ) : +val; } return val === "" || isNaN( val ) ? null : val; }, @@ -330,7 +332,7 @@ $.widget( "ui.spinner", { return ""; } return window.Globalize && this.options.numberFormat ? - Globalize.format( value, this.options.numberFormat ) : + Globalize.format( value, this.options.numberFormat, this.options.culture ) : value; }, -- cgit v1.2.3