aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorjzaefferer <joern.zaefferer@gmail.com>2010-10-24 15:57:58 +0200
committerjzaefferer <joern.zaefferer@gmail.com>2010-10-24 15:57:58 +0200
commit1be2a79076e4da314ca6317082fbd8c03e7f9d63 (patch)
treefabebf6bef4630fb37c2f762187ac68bc283c629 /tests
parent02d8f914b68f73537dcaca272087b544b366bb2b (diff)
downloadjquery-ui-1be2a79076e4da314ca6317082fbd8c03e7f9d63.tar.gz
jquery-ui-1be2a79076e4da314ca6317082fbd8c03e7f9d63.zip
Spinner: More cleanup
Diffstat (limited to 'tests')
-rw-r--r--tests/unit/spinner/spinner_defaults.js1
-rw-r--r--tests/unit/spinner/spinner_options.js303
2 files changed, 2 insertions, 302 deletions
diff --git a/tests/unit/spinner/spinner_defaults.js b/tests/unit/spinner/spinner_defaults.js
index 7eb3f0a17..a85891970 100644
--- a/tests/unit/spinner/spinner_defaults.js
+++ b/tests/unit/spinner/spinner_defaults.js
@@ -11,7 +11,6 @@ var spinner_defaults = {
mouseWheel: true,
numberformat: "n",
page: 5,
- spinnerClass: null,
step: null,
value: 0
};
diff --git a/tests/unit/spinner/spinner_options.js b/tests/unit/spinner/spinner_options.js
index c3bcac820..4e280ef6a 100644
--- a/tests/unit/spinner/spinner_options.js
+++ b/tests/unit/spinner/spinner_options.js
@@ -5,197 +5,8 @@
module("spinner: options");
-test("buttons - show (default)", function() {
- expect(4);
-
- el = $('#spin');
- el.spinner({
- buttons: 'show'
- });
-
- ok(upButton().is(':visible'), "show - before hover: up button visible");
- ok(downButton().is(':visible'), "show - before hover: down button visible");
-
- el.trigger('mouseover');
-
- ok(upButton().is(':visible'), "show - after hover: up button visible");
- ok(downButton().is(':visible'), "show - after hover: down button visible");
-
- el.trigger('mouseout');
-});
-
-test("buttons - hide", function() {
- expect(4);
-
- el = $('#spin');
- el.spinner({
- buttons: 'hide'
- });
-
- ok(upButton().is(':hidden'), "hide - before hover: up button hidden");
- ok(downButton().is(':hidden'), "hide - before hover: down button hidden");
-
- el.trigger('mouseover');
-
- ok(upButton().is(':hidden'), "hide - after hover: up button hidden");
- ok(downButton().is(':hidden'), "hide - after hover: down button hidden");
-
- el.trigger('mouseout');
-});
-
-test("buttons - auto (hover)", function() {
- expect(4);
-
- el = $('#spin');
- el.spinner({
- buttons: 'auto'
- });
-
- ok(upButton().is(':hidden'), "auto - before hover: up button hidden");
- ok(downButton().is(':hidden'), "auto - before hover: down button hidden");
-
- el.trigger('mouseover');
-
- ok(upButton().is(':visible'), "auto - after hover: up button visible");
- ok(downButton().is(':visible'), "auto - after hover: down button visible");
-
- el.trigger('mouseout');
-});
-
-test("buttons - auto (focus)", function() {
- expect(4);
-
- el = $('#spin');
- el.spinner({
- buttons: 'auto'
- });
-
- ok(upButton().is(':hidden'), "auto - before focus: up button hidden");
- ok(downButton().is(':hidden'), "auto - before focus: down button hidden");
-
- el.focus();
-
- ok(upButton().is(':visible'), "auto - after focus: up button visible");
- ok(downButton().is(':visible'), "auto - after focus: down button visible");
-
- el.trigger('mouseout');
-});
-
-test("currency - single character currency symbol", function() {
- expect(5);
-
- el = $("#spin");
-
- options = {
- currency:"$",
- max:120,
- min:-50,
- step:0.3
- };
-
- el.spinner(options);
-
- equals(el.val(), "$0.00", "start number");
-
- simulateKeyDownUp(el, $.ui.keyCode.UP);
-
- equals(el.val(), "$0.30", "stepping 0.30");
-
- simulateKeyDownUp(el, $.ui.keyCode.END);
-
- equals(el.val(), "$120.00", "End key to max");
-
- simulateKeyDownUp(el, $.ui.keyCode.HOME);
-
- equals(el.val(), "-$50.00", "Home key to min");
-
- for ( var i = 1 ; i<=120 ; i++ ) {
- simulateKeyDownUp(el, $.ui.keyCode.UP);
- }
-
- equals(el.val(), "-$14.00", "keydown 120 times");
-});
-
-test("currency - combined character currency symbol", function() {
- expect(2);
-
- el = $('#spin');
-
- options = {
- currency: 'HK$',
- step: 1500.50,
- value: 1000
- }
-
- el.spinner(options);
-
- equals(el.val(), "HK$1,000.00", "Hong Kong Dollar");
-
- simulateKeyDownUp(el, $.ui.keyCode.UP);
-
- equals(el.val(), "HK$2,500.50", "Hong Kong Dollar step-up once");
-});
-
-test("currency - space as group separator", function() {
- expect(2);
-
- el = $('#spin');
-
- options = {
- currency: '$',
- groupSeparator: ' ',
- radixPoint: '.',
- step: 1500.50,
- value: 1000
- }
-
- el.spinner(options);
-
- equals(el.val(), "$1 000.00", "Australian Dollar");
-
- simulateKeyDownUp(el, $.ui.keyCode.UP);
-
- equals(el.val(), "$2 500.50", "Australian Dollar step-up once");
-});
-
-test("currency - apos as group separator", function() {
- expect(2);
-
- el = $('#spin');
- options = {
- currency: 'Fr ',
- groupSeparator: "'",
- radixPoint: '.',
- step: 1500.50,
- value: 1000
- }
- el.spinner(options);
-
- equals(el.val(), "Fr 1'000.00", "Swiss Franc");
-
- simulateKeyDownUp(el, $.ui.keyCode.UP);
-
- equals(el.val(), "Fr 2'500.50", "Swiss Franc step-up once");
-});
-
-test("currency - period as group separator and comma as radixPoint", function() {
- expect(2);
-
- el = $('#spin');
- options = {
- currency: 'RUB',
- groupSeparator: ".",
- radixPoint: ',',
- step: 1.5,
- value: 1000
- }
- el.spinner(options);
-
- equals(el.val(), "RUB1.000,00", "Russian Ruble");
-
- simulateKeyDownUp(el, $.ui.keyCode.UP);
-
- equals(el.val(), "RUB1.001,50", "Russian Ruble step-up once");
+test("numberformat", function() {
+ ok( false, "tests for numberformat!");
});
test("dir - left-to-right (default)", function() {
@@ -220,42 +31,6 @@ test("dir - right-to-left", function() {
ok(wrapper().hasClass('ui-spinner-rtl'), 'container has correct text direction class setting');
});
-test("groupSeparator - comma separator (default)", function() {
- expect(1);
-
- el = $('#spin');
- options = {
- groupSeparator: ',',
- value: 1000000
- };
- el.spinner(options);
- equals(el.val(), "1,000,000", "value contains 2 commas separated by 3 digits");
-});
-
-test("groupSeparator - space separator", function() {
- expect(1);
-
- el = $('#spin');
- options = {
- groupSeparator: ' ',
- value: 1000000
- };
- el.spinner(options);
- equals(el.val(), "1 000 000", "value contains 2 spaces separated by 3 digits");
-});
-
-test("groupSeparator - apos separator", function() {
- expect(1);
-
- el = $('#spin');
- options = {
- groupSeparator: "'",
- value: 1000000
- };
- el.spinner(options);
- equals(el.val(), "1'000'000", "value contains apos separated by 3 digits");
-});
-
test("incremental - false (default)", function() {
expect(2);
@@ -326,20 +101,6 @@ test("mouseWheel", function() {
ok(false, 'missing test - untested code is broken code');
});
-test("padding", function() {
- expect(3);
-
- el = $('#spin').spinner({ padding: 5, value: 10 });
-
- equals(el.val(), '00010', 'padded output');
-
- el.spinner('option', 'padding', 4);
- equals(el.val(), '0010', 'padded output');
-
- el.spinner('value', 15);
- equals(el.val(), '0015', 'padded output');
-});
-
test("page", function() {
expect(3);
@@ -358,66 +119,6 @@ test("page", function() {
equals(el.val(), "50", "PAGE_UP 11 times on spinner");
});
-test("precision", function() {
- expect(3);
-
- el = $("#spin").spinner({ precision: 4, value: 1.23456789 });
-
- equals(el.val(), '1.2346', "4 decimal places");
-
- el.spinner('option', 'precision', 2);
-
- equals(el.val(), '1.23', "2 decimal places");
-
- el.spinner('option', 'precision', 6);
-
- equals(el.val(), '1.234568', "6 decimal places");
-});
-
-test("radix", function() {
- expect(2);
-
- el = $("#spin").spinner({
- radix: 16,
- value: 10
- });
-
- equals(el.val(), 'a', 'start value');
-
- simulateKeyDownUp(el, $.ui.keyCode.UP);
-
- equals(el.val(), 'b', 'key UP on spinner')
-});
-
-test("radixPoint", function() {
- el = $("#spin").spinner({
- radixPoint: ',',
- value: 20.00,
- precision: 2
- });
-
- equals(el.val(), '20,00', 'comma radix point');
-
- el.spinner('stepUp');
-
- equals(el.val(), '21,00', 'step up one');
-
- el.spinner('pageDown', 10);
-
- equals(el.val(), '-29,00', 'page down into negative space');
-});
-
-test("spinnerClass", function() {
- expect(3);
-
- el = $('#spin').spinner({spinnerClass: 'my-spinner-class'});
- ok(wrapper().hasClass('my-spinner-class'), 'spinner container has custom class');
-
- el.spinner('option', 'spinnerClass', 'new-spinner-class');
- ok(!wrapper().hasClass('my-spinner-class'), 'spinner no longer has old custom class');
- ok(wrapper().hasClass('new-spinner-class'), 'spinner now has new custom class');
-});
-
test("step", function() {
expect(7);