diff options
author | Scott González <scott.gonzalez@gmail.com> | 2010-12-10 14:11:20 -0500 |
---|---|---|
committer | Scott González <scott.gonzalez@gmail.com> | 2010-12-10 14:11:20 -0500 |
commit | 9ad2a4b1ccebb32cc745be3ef85a4b634e416ff8 (patch) | |
tree | ed68f18d4d84f6bd6d021a668ade484f9b7bda93 /tests | |
parent | 0e15f573d6f1d5c138ce63d2a462737dbb874faa (diff) | |
download | jquery-ui-9ad2a4b1ccebb32cc745be3ef85a4b634e416ff8.tar.gz jquery-ui-9ad2a4b1ccebb32cc745be3ef85a4b634e416ff8.zip |
Widget: Throw errors for invalid method calls. Fixes #5972 - Widget: Throw error for non-existent method calls.
Diffstat (limited to 'tests')
-rw-r--r-- | tests/unit/widget/widget_core.js | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/tests/unit/widget/widget_core.js b/tests/unit/widget/widget_core.js index 2673350f3..c01cd6542 100644 --- a/tests/unit/widget/widget_core.js +++ b/tests/unit/widget/widget_core.js @@ -120,6 +120,23 @@ test( "direct usage", function() { equals( instance.getterSetterVal, 30, "getter/setter can act as setter" ); }); +test( "error handling", function() { + expect( 2 ); + var error = $.error; + $.widget( "ui.testWidget", {} ); + $.error = function( msg ) { + equal( msg, "cannot call methods on testWidget prior to initialization; " + + "attempted to call method 'missing'", "method call before init" ); + }; + $( "<div>" ).testWidget( "missing" ); + $.error = function( msg ) { + equal( msg, "no such method 'missing' for testWidget widget instance", + "invalid method call on widget instance" ); + }; + $( "<div>" ).testWidget().testWidget( "missing" ); + $.error = error; +}); + test("merge multiple option arguments", function() { expect( 1 ); $.widget( "ui.testWidget", { |