diff options
author | Chi Cheng <cloudream@gmail.com> | 2008-08-19 09:54:47 +0000 |
---|---|---|
committer | Chi Cheng <cloudream@gmail.com> | 2008-08-19 09:54:47 +0000 |
commit | 62ed7d038860d25dfda32a998d0e10585b866822 (patch) | |
tree | 6690de8a3661e85d0fae087422b1d1af77c89254 | |
parent | fd1f2e08ed8f1ac9b8f4e1e418ca6306d6b700b5 (diff) | |
download | jquery-ui-62ed7d038860d25dfda32a998d0e10585b866822.tar.gz jquery-ui-62ed7d038860d25dfda32a998d0e10585b866822.zip |
spinner test
-rw-r--r-- | tests/spinner.js | 40 |
1 files changed, 26 insertions, 14 deletions
diff --git a/tests/spinner.js b/tests/spinner.js index a09588ff7..548d79e17 100644 --- a/tests/spinner.js +++ b/tests/spinner.js @@ -7,34 +7,44 @@ module("spinner");
test("init", function() {
- expect(1);
+ expect(3);
- el = $("#spin").spinner();
+ $("#spin").spinner();
ok(true, '.spinner() called on element');
+ $([]).spinner().remove();
+ ok(true, '.spinner() called on empty collection');
+
+ $('<input id="spinner_dis">').spinner().remove();
+ ok(true, '.spinner() called on disconnected element');
+
});
test("destroy", function() {
- expect(1);
+ expect(3);
$("#spin").spinner().spinner("destroy");
ok(true, '.spinner("destroy") called on element');
+ $([]).spinner().spinner("destroy").remove();
+ ok(true, '.spinner().spinner("destroy") called on empty collection');
+
+ $('<input id="spinner_dis">').spinner().spinner("destroy").remove();
+ ok(true, '.spinner().spinner("destroy") called on disconnected element');
+
});
test("re-attach", function() {
- expect(1);
+ expect(3);
el = $("#spin").spinner().spinner("destroy").spinner();
ok(true, '.spinner().spinner("destroy").spinner() called on element');
-});
-
-test("disabled on init", function() {
- expect(1);
+ $([]).spinner().spinner("destroy").spinner().remove();
+ ok(true, '.spinner().spinner("destroy").spinner() called on empty collection');
- $("#spin").spinner({disabled:true});
- ok(true, '.spinner({disabled:true}) called on element');
+ $('<input id="spinner_dis">').spinner().spinner("destroy").spinner().remove();
+ ok(true, '.spinner().spinner("destroy").spinner() called on disconnected element');
});
@@ -49,16 +59,17 @@ test("disable", function() { test("enable", function() {
expect(1);
- $("#spin").spinner().spinner("destroy").spinner("enable");
+ $("#spin").spinner().spinner("disable").spinner("enable");
ok(true, '.spinner("enable") called on element');
});
test("defaults", function() {
- expect(6);
+ expect(7);
el = $("#spin").spinner();
equals(el.data("currency.spinner"), false, "currency");
+ equals(el.data("disabled.spinner"), false, "disabled");
equals(el.data("incremental.spinner"), true, "incremental");
equals(el.data("max.spinner"), undefined, "max");
equals(el.data("min.spinner"), undefined, "min");
@@ -68,10 +79,11 @@ test("defaults", function() { });
test("set defaults on init", function() {
- expect(6);
- el = $("#spin").spinner({ currency:true, incremental:false, max:200, min:-100, start:50, stepping:2 });
+ expect(7);
+ el = $("#spin").spinner({ currency:true, disabled:true, incremental:false, max:200, min:-100, start:50, stepping:2 });
equals(el.data("currency.spinner"), true, "currency");
+ equals(el.data("disabled.spinner"), true, "disabled");
equals(el.data("incremental.spinner"), false, "incremental");
equals(el.data("max.spinner"), 200, "max");
equals(el.data("min.spinner"), -100, "min");
|