From 7dde5c9d75148cdca7cf86ff0c6e310fdc5a4054 Mon Sep 17 00:00:00 2001 From: Scott González Date: Thu, 17 Sep 2015 08:47:08 -0400 Subject: Widget: Call `._setOptionDisabled()` on init if the widget is disabled Fixes #9151 Ref gh-1599 --- tests/unit/widget/core.js | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) (limited to 'tests/unit') 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() { $( "
" ).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" ); + }; + $( "
" ).testWidget(); + + method = function( value ) { + strictEqual( value, true, "._setOptionDisabled called on init when disabled" ); + }; + widget = $( "
" ).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", { -- cgit v1.2.3