diff options
author | Scott González <scott.gonzalez@gmail.com> | 2015-09-17 08:47:08 -0400 |
---|---|---|
committer | Scott González <scott.gonzalez@gmail.com> | 2015-09-25 13:46:25 -0400 |
commit | 7dde5c9d75148cdca7cf86ff0c6e310fdc5a4054 (patch) | |
tree | a4809a983cee6e63b487d8c121dc268be47e3c64 /tests/unit | |
parent | 0db243a7369bc1e642a83d8b84be9437c360f7e2 (diff) | |
download | jquery-ui-7dde5c9d75148cdca7cf86ff0c6e310fdc5a4054.tar.gz jquery-ui-7dde5c9d75148cdca7cf86ff0c6e310fdc5a4054.zip |
Widget: Call `._setOptionDisabled()` on init if the widget is disabled
Fixes #9151
Ref gh-1599
Diffstat (limited to 'tests/unit')
-rw-r--r-- | tests/unit/widget/core.js | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/tests/unit/widget/core.js b/tests/unit/widget/core.js index 6ad1e74fc..93bfe875a 100644 --- a/tests/unit/widget/core.js +++ b/tests/unit/widget/core.js @@ -729,6 +729,39 @@ test( ".disable()", function() { $( "<div>" ).testWidget().testWidget( "disable" ); } ); +test( "._setOptionDisabled()", function() { + expect( 3 ); + + var method; + var widget; + + $.widget( "ui.testWidget", { + _setOptionDisabled: function( value ) { + method( value ); + } + } ); + + method = function() { + ok( false, "._setOptionDisabled() called on init when not disabled" ); + }; + $( "<div>" ).testWidget(); + + method = function( value ) { + strictEqual( value, true, "._setOptionDisabled called on init when disabled" ); + }; + widget = $( "<div>" ).testWidget( { disabled: true } ); + + method = function( value ) { + strictEqual( value, false, "._setOptionDisabled called when enabling" ); + }; + widget.testWidget( "enable" ); + + method = function( value ) { + strictEqual( value, true, "._setOptionDisabled called when disabling" ); + }; + widget.testWidget( "option", "disabled", true ); +} ); + test( ".widget() - base", function() { expect( 2 ); var constructor = $.widget( "ui.testWidget", { |