aboutsummaryrefslogtreecommitdiffstats
path: root/tests/unit/widget/widget_core.js
diff options
context:
space:
mode:
authorJörn Zaefferer <joern.zaefferer@gmail.com>2011-06-19 14:45:20 +0200
committerJörn Zaefferer <joern.zaefferer@gmail.com>2011-06-19 14:45:20 +0200
commitaa7f8195f8c288dbefcb92064b68cb28064ac64c (patch)
tree333cd184f8a830c1b588e3d3d0368c134648a3b6 /tests/unit/widget/widget_core.js
parent391282a9aeb4e5bb6ba6655d7f1d5d125f93155a (diff)
parentfb210ae1ec16cefb1e4d4dfaf7d55499cac53ab8 (diff)
downloadjquery-ui-aa7f8195f8c288dbefcb92064b68cb28064ac64c.tar.gz
jquery-ui-aa7f8195f8c288dbefcb92064b68cb28064ac64c.zip
Merge branch 'master' into widget-delegation
Diffstat (limited to 'tests/unit/widget/widget_core.js')
-rw-r--r--tests/unit/widget/widget_core.js19
1 files changed, 19 insertions, 0 deletions
diff --git a/tests/unit/widget/widget_core.js b/tests/unit/widget/widget_core.js
index 892336c50..bb21b74ea 100644
--- a/tests/unit/widget/widget_core.js
+++ b/tests/unit/widget/widget_core.js
@@ -413,6 +413,7 @@ test( ".option() - getter", function() {
qux: [ "quux", "quuux" ]
});
+ same( div.testWidget( "option", "x" ), null, "non-existent option" );
same( div.testWidget( "option", "foo"), "bar", "single option - string" );
same( div.testWidget( "option", "baz"), 5, "single option - number" );
same( div.testWidget( "option", "qux"), [ "quux", "quuux" ],
@@ -431,6 +432,24 @@ test( ".option() - getter", function() {
"modifying returned options hash does not modify plugin instance" );
});
+test( ".option() - deep option getter", function() {
+ $.widget( "ui.testWidget", {} );
+ var div = $( "<div>" ).testWidget({
+ foo: {
+ bar: "baz",
+ qux: {
+ quux: "xyzzy"
+ }
+ }
+ });
+ equal( div.testWidget( "option", "foo.bar" ), "baz", "one level deep - string" );
+ deepEqual( div.testWidget( "option", "foo.qux" ), { quux: "xyzzy" },
+ "one level deep - object" );
+ equal( div.testWidget( "option", "foo.qux.quux" ), "xyzzy", "two levels deep - string" );
+ equal( div.testWidget( "option", "x.y" ), null, "top level non-existent" );
+ equal( div.testWidget( "option", "foo.x.y" ), null, "one level deep - non-existent" );
+});
+
test( ".option() - delegate to ._setOptions()", function() {
var calls = [];
$.widget( "ui.testWidget", {