diff options
author | William Kevin Manire <williamkmanire@gmail.com> | 2011-02-16 00:28:32 -0800 |
---|---|---|
committer | William Kevin Manire <williamkmanire@gmail.com> | 2011-02-16 00:28:32 -0800 |
commit | c94ec23b263464af3dfa4533eff45fc0d6fef954 (patch) | |
tree | 655a58f374d4d431f3d1f3a9d57880428a9e7b15 /tests/unit/widget | |
parent | ed531ef0d3c171f8e534543a07a4c6244c169c57 (diff) | |
download | jquery-ui-c94ec23b263464af3dfa4533eff45fc0d6fef954.tar.gz jquery-ui-c94ec23b263464af3dfa4533eff45fc0d6fef954.zip |
Widget: modified widget to throw exception on attempt to call private methods. Fixed #6947 - Attempt to access private member of widget returns jQuery object
Diffstat (limited to 'tests/unit/widget')
-rw-r--r-- | tests/unit/widget/widget_core.js | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/tests/unit/widget/widget_core.js b/tests/unit/widget/widget_core.js index b92885fd9..11325140f 100644 --- a/tests/unit/widget/widget_core.js +++ b/tests/unit/widget/widget_core.js @@ -166,9 +166,11 @@ test( "direct usage", function() { }); test( "error handling", function() { - expect( 2 ); + expect( 3 ); var error = $.error; - $.widget( "ui.testWidget", {} ); + $.widget( "ui.testWidget", { + _privateMethod: function () {} + }); $.error = function( msg ) { equal( msg, "cannot call methods on testWidget prior to initialization; " + "attempted to call method 'missing'", "method call before init" ); @@ -179,6 +181,11 @@ test( "error handling", function() { "invalid method call on widget instance" ); }; $( "<div>" ).testWidget().testWidget( "missing" ); + $.error = function ( msg ) { + equal( msg, "no such method '_privateMethod' for testWidget widget instance", + "invalid method call on widget instance" ); + }; + $( "<div>" ).testWidget().testWidget( "_privateMethod" ); $.error = error; }); |