diff options
author | Scott González <scott.gonzalez@gmail.com> | 2012-10-22 15:33:57 -0400 |
---|---|---|
committer | Scott González <scott.gonzalez@gmail.com> | 2012-10-22 15:36:11 -0400 |
commit | 9b908878ae3a9c0fbbd9958b579f223a648c5c69 (patch) | |
tree | 2b6576b8460b81ae1394bbc0cad47b6928277ebf /tests | |
parent | 6bedc0af357d9326ac39c37372b04d3bf7747454 (diff) | |
download | jquery-ui-9b908878ae3a9c0fbbd9958b579f223a648c5c69.tar.gz jquery-ui-9b908878ae3a9c0fbbd9958b579f223a648c5c69.zip |
Widget: $.widget.extend(): Properly handle extending a string with an object. Fixes #8713 - Passing an object as ui.resizable handles parameter does not work.
Diffstat (limited to 'tests')
-rw-r--r-- | tests/unit/widget/widget_extend.js | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/tests/unit/widget/widget_extend.js b/tests/unit/widget/widget_extend.js index 3ad59a9cc..14f9a46e0 100644 --- a/tests/unit/widget/widget_extend.js +++ b/tests/unit/widget/widget_extend.js @@ -1,5 +1,5 @@ test( "$.widget.extend()", function() { - expect( 26 ); + expect( 27 ); var ret, empty, optionsWithLength, optionsWithDate, myKlass, customObject, optionsWithCustomObject, nullUndef, target, recursive, obj, input, output, @@ -76,13 +76,16 @@ test( "$.widget.extend()", function() { ret = $.widget.extend( { foo: [] }, { foo: [0] } ); // 1907 equal( ret.foo.length, 1, "Check to make sure a value with coersion 'false' copies over when necessary to fix #1907" ); - ret = $.widget.extend( { foo: "1,2,3" }, { foo: [1, 2, 3] } ); - strictEqual( typeof ret.foo, "object", "Check to make sure values equal with coersion (but not actually equal) overwrite correctly" ); + ret = $.widget.extend( { foo: "1,2,3" }, { foo: [ 1, 2, 3 ] } ); + deepEqual( ret.foo, [ 1, 2, 3 ], "Properly extend a string to array." ); + + ret = $.widget.extend( { foo: "1,2,3" }, { foo: { to: "object" } } ); + deepEqual( ret.foo, { to: "object" }, "Properly extend a string to object." ); ret = $.widget.extend( { foo: "bar" }, { foo: null } ); - strictEqual( typeof ret.foo, "object", "Make sure a null value doesn't crash with deep extend, for #1908" ); + strictEqual( ret.foo, null, "Make sure a null value doesn't crash with deep extend, for #1908" ); - obj = { foo:null }; + obj = { foo: null }; $.widget.extend( obj, { foo:"notnull" } ); equal( obj.foo, "notnull", "Make sure a null value can be overwritten" ); |