aboutsummaryrefslogtreecommitdiffstats
path: root/tests/unit/widget
diff options
context:
space:
mode:
authorScott González <scott.gonzalez@gmail.com>2010-09-27 11:21:09 -0400
committerScott González <scott.gonzalez@gmail.com>2010-09-27 11:21:09 -0400
commit9d88b565d6f65dc1aaebfaf99699f6155370949c (patch)
treef40b589e75d7c57c1214b43dff0f8283bf20685a /tests/unit/widget
parent0b6710aed7fc9a9412a975c9f70d3fd6a87c4b02 (diff)
downloadjquery-ui-9d88b565d6f65dc1aaebfaf99699f6155370949c.tar.gz
jquery-ui-9d88b565d6f65dc1aaebfaf99699f6155370949c.zip
Widget: Added _setOptions method for handling normalized options setting. Fixes #6114 - Widget: Add _setOptions() method.
Diffstat (limited to 'tests/unit/widget')
-rw-r--r--tests/unit/widget/widget_core.js25
1 files changed, 24 insertions, 1 deletions
diff --git a/tests/unit/widget/widget_core.js b/tests/unit/widget/widget_core.js
index 604222106..76d6543c2 100644
--- a/tests/unit/widget/widget_core.js
+++ b/tests/unit/widget/widget_core.js
@@ -209,7 +209,30 @@ test( ".option() - getter", function() {
"modifying returned options hash does not modify plugin instance" );
});
-test( ".option() - setter", function() {
+test( ".option() - delegate to ._setOptions()", function() {
+ var calls = [];
+ $.widget( "ui.testWidget", {
+ _create: function() {},
+ _setOptions: function( options ) {
+ calls.push( options );
+ }
+ });
+ var div = $( "<div></div>" ).testWidget();
+
+ calls = [];
+ div.testWidget( "option", "foo", "bar" );
+ same( calls, [{ foo: "bar" }], "_setOptions called for single option" );
+
+ calls = [];
+ div.testWidget( "option", {
+ bar: "qux",
+ quux: "quuux"
+ });
+ same( calls, [{ bar: "qux", quux: "quuux" }],
+ "_setOptions called with multiple options" );
+});
+
+test( ".option() - delegate to ._setOption()", function() {
var calls = [];
$.widget( "ui.testWidget", {
_create: function() {},