diff options
author | Scott González <scott.gonzalez@gmail.com> | 2011-03-22 14:35:18 -0400 |
---|---|---|
committer | Scott González <scott.gonzalez@gmail.com> | 2011-03-22 14:35:18 -0400 |
commit | f77224055a65f8343cd53411608a95d98db97138 (patch) | |
tree | 49aef8eb9174f45659bd682a1e736f41282629ea /tests | |
parent | e7991e33f3c5d20d6efdb18654859175ef5cac68 (diff) | |
download | jquery-ui-f77224055a65f8343cd53411608a95d98db97138.tar.gz jquery-ui-f77224055a65f8343cd53411608a95d98db97138.zip |
Widget: Maintain stack when a method returns a jQuery object. Fixes #5732 - Widget: Make the widget method maintain the stack.
Diffstat (limited to 'tests')
-rw-r--r-- | tests/unit/widget/widget_core.js | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/tests/unit/widget/widget_core.js b/tests/unit/widget/widget_core.js index 319423797..300acd0d8 100644 --- a/tests/unit/widget/widget_core.js +++ b/tests/unit/widget/widget_core.js @@ -74,7 +74,7 @@ test( "element normalization", function() { }); test( "jQuery usage", function() { - expect( 11 ); + expect( 13 ); var shouldCreate = false; @@ -98,6 +98,9 @@ test( "jQuery usage", function() { } else { return this.getterSetterVal; } + }, + jQueryObject: function() { + return $( "body" ); } }); @@ -120,6 +123,9 @@ test( "jQuery usage", function() { ret = elem.testWidget( "getterSetterMethod", 30 ); equals( ret, elem, "getter/setter method can be chainable" ); equals( instance.getterSetterVal, 30, "getter/setter can act as setter" ); + ret = elem.testWidget( "jQueryObject" ); + equal( ret[ 0 ], document.body, "returned jQuery object" ); + equal( ret.end(), elem, "stack preserved" ); }); test( "direct usage", function() { @@ -765,7 +771,7 @@ test( "._trigger() - provide event and ui", function() { .testWidget( "testEvent" ); }); -test( "._triger() - instance as element", function() { +test( "._trigger() - instance as element", function() { expect( 4 ); $.widget( "ui.testWidget", { defaultElement: null, |