aboutsummaryrefslogtreecommitdiffstats
path: root/tests/spinner.js
diff options
context:
space:
mode:
authorRichard Worth <rdworth@gmail.com>2008-11-12 02:52:31 +0000
committerRichard Worth <rdworth@gmail.com>2008-11-12 02:52:31 +0000
commite47820f6ea7810569684464c3a3b02eda5d9604d (patch)
treeadb2aba03fe9d7736ac72118b754101e696f37fa /tests/spinner.js
parent7d946ec774e7fd832c0c691076338eae69e9b894 (diff)
downloadjquery-ui-e47820f6ea7810569684464c3a3b02eda5d9604d.tar.gz
jquery-ui-e47820f6ea7810569684464c3a3b02eda5d9604d.zip
tests: cleanup and consistency with defaults tests
Diffstat (limited to 'tests/spinner.js')
-rw-r--r--tests/spinner.js33
1 files changed, 31 insertions, 2 deletions
diff --git a/tests/spinner.js b/tests/spinner.js
index fdb81547e..ea7fe1809 100644
--- a/tests/spinner.js
+++ b/tests/spinner.js
@@ -2,6 +2,26 @@
* spinner unit tests
*/
(function($) {
+//
+// Spinner Test Helper Functions
+//
+
+var defaults = {
+ currency: false,
+ decimals: 0,
+ disabled: false,
+ format: "%",
+ group: "",
+ incremental: true,
+ items: null,
+ max: null,
+ min: null,
+ point: ".",
+ start: 0,
+ stepping: 1
+};
+
+var el;
// Spinner Tests
module("spinner");
@@ -9,7 +29,7 @@ module("spinner");
test("init", function() {
expect(2);
- $("#spin").spinner();
+ $("<div></div>").appendTo('body').spinner().remove();
ok(true, '.spinner() called on element');
$('<input id="spinner_dis">').spinner().remove();
@@ -20,7 +40,7 @@ test("init", function() {
test("destroy", function() {
expect(2);
- $("#spin").spinner().spinner("destroy");
+ $("<div></div>").appendTo('body').spinner().spinner("destroy").remove();
ok(true, '.spinner("destroy") called on element');
$('<input id="spinner_dis">').spinner().spinner("destroy").remove();
@@ -28,6 +48,15 @@ test("destroy", function() {
});
+test("defaults", function() {
+ el = $('<div></div>').spinner();
+ $.each(defaults, function(key, val) {
+ var actual = el.data(key + ".spinner"), expected = val;
+ same(actual, expected, key);
+ });
+ el.remove();
+});
+
test("re-attach", function() {
expect(2);