aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorScott González <scott.gonzalez@gmail.com>2011-09-28 18:30:58 -0400
committerScott González <scott.gonzalez@gmail.com>2011-09-28 18:30:58 -0400
commitc2f036277c6190bc8677bc0eac53c22ed5e8a08d (patch)
tree2c254390135d5a48a157aa70ecd8905df0f23ea8 /tests
parent39b452e1be8d6ef9006c26be3495c633d15ff96f (diff)
downloadjquery-ui-c2f036277c6190bc8677bc0eac53c22ed5e8a08d.tar.gz
jquery-ui-c2f036277c6190bc8677bc0eac53c22ed5e8a08d.zip
Spinner: Added culture option.
Diffstat (limited to 'tests')
-rw-r--r--tests/unit/spinner/spinner.html1
-rw-r--r--tests/unit/spinner/spinner_defaults.js1
-rw-r--r--tests/unit/spinner/spinner_options.js25
3 files changed, 27 insertions, 0 deletions
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 @@
<script src="../../jquery.js"></script>
<script src="../../../external/jquery.mousewheel-3.0.4.js"></script>
<script src="../../../external/globalize.js"></script>
+ <script src="../../../external/globalize.culture.ja-JP.js"></script>
<script src="../../../ui/jquery.ui.core.js"></script>
<script src="../../../ui/jquery.ui.widget.js"></script>
<script src="../../../ui/jquery.ui.button.js"></script>
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 });