diff options
author | jzaefferer <joern.zaefferer@gmail.com> | 2010-10-25 17:32:08 +0200 |
---|---|---|
committer | jzaefferer <joern.zaefferer@gmail.com> | 2010-10-25 17:32:08 +0200 |
commit | 299d5c88b8bd60b23c03f73fd0dc8bf4d9cfb2a2 (patch) | |
tree | 4ec1d0929d1c037ecc302e8e68dc8a26245477e9 /tests/unit/spinner | |
parent | 1be2a79076e4da314ca6317082fbd8c03e7f9d63 (diff) | |
download | jquery-ui-299d5c88b8bd60b23c03f73fd0dc8bf4d9cfb2a2.tar.gz jquery-ui-299d5c88b8bd60b23c03f73fd0dc8bf4d9cfb2a2.zip |
Spinner: Fix value option initalization
Diffstat (limited to 'tests/unit/spinner')
-rw-r--r-- | tests/unit/spinner/spinner.html | 1 | ||||
-rw-r--r-- | tests/unit/spinner/spinner_defaults.js | 2 | ||||
-rw-r--r-- | tests/unit/spinner/spinner_options.js | 29 |
3 files changed, 24 insertions, 8 deletions
diff --git a/tests/unit/spinner/spinner.html b/tests/unit/spinner/spinner.html index 954e82ea5..a9902a251 100644 --- a/tests/unit/spinner/spinner.html +++ b/tests/unit/spinner/spinner.html @@ -34,6 +34,7 @@ <div id="qunit-fixture">
<input id="spin">
+ <input id="spin2" value="2">
</div>
</body>
diff --git a/tests/unit/spinner/spinner_defaults.js b/tests/unit/spinner/spinner_defaults.js index a85891970..aa88fd649 100644 --- a/tests/unit/spinner/spinner_defaults.js +++ b/tests/unit/spinner/spinner_defaults.js @@ -12,7 +12,7 @@ var spinner_defaults = { numberformat: "n",
page: 5,
step: null,
- value: 0
+ value: null
};
commonWidgetTests('spinner', { defaults: spinner_defaults });
diff --git a/tests/unit/spinner/spinner_options.js b/tests/unit/spinner/spinner_options.js index 4e280ef6a..48fea3203 100644 --- a/tests/unit/spinner/spinner_options.js +++ b/tests/unit/spinner/spinner_options.js @@ -157,15 +157,30 @@ test("step", function() { });
-test("value", function() {
- expect(2);
-
- el = $('#spin').spinner({ value: 100 });
-
+test("value, default, specified in markup", function() {
+ var el = $('#spin2').spinner();
+ equals(el.val(), 2, "starting value");
+});
+
+test("value, default, nothing specified", function() {
+ var el = $('#spin').spinner();
+ equals(el.val(), 0, "starting value");
+});
+
+test("value, override", function() {
+ var el = $('#spin').spinner({ value: 100 });
equals(el.val(), 100, "starting value");
-
+});
+
+test("value, override markup", function() {
+ var el = $('#spin2').spinner({ value: 100 });
+ equals(el.val(), 100, "starting value");
+});
+
+test("value, override later", function() {
+ var el = $('#spin').spinner();
+ equals(el.val(), 0, "starting value");
el.spinner('option', 'value', 1000);
-
equals(el.val(), 1000, "value option changed and set as current value");
});
|