From: jenkins-bot Date: Thu, 10 Nov 2016 20:46:42 +0000 (+0000) Subject: Merge "Fix ApiSandbox" X-Git-Tag: 1.31.0-rc.0~4895 X-Git-Url: https://git.cyclocoop.org/%27.WWW_URL.%27admin/?a=commitdiff_plain;h=a4174e765db7997682bded0195cac9a58657a6d9;hp=e99f5e80d2b9ba5e2a053ff9855e68b10f79b751;p=lhc%2Fweb%2Fwiklou.git Merge "Fix ApiSandbox" --- diff --git a/resources/src/mediawiki.special/mediawiki.special.apisandbox.js b/resources/src/mediawiki.special/mediawiki.special.apisandbox.js index 98ed3eecfb..a206328b16 100644 --- a/resources/src/mediawiki.special/mediawiki.special.apisandbox.js +++ b/resources/src/mediawiki.special/mediawiki.special.apisandbox.js @@ -26,7 +26,11 @@ }, apiCheckValid: function () { var that = this; - return this.isValid().done( function ( ok ) { + return this.getValidity().then( function () { + return $.Deferred().resolve( true ).promise(); + }, function () { + return $.Deferred().resolve( false ).promise(); + } ).done( function ( ok ) { ok = ok || suppressErrors; that.setIcon( ok ? null : 'alert' ); that.setIconTitle( ok ? '' : mw.message( 'apisandbox-alert-field' ).plain() ); @@ -35,9 +39,12 @@ }, dateTimeInputWidget: { - isValid: function () { - var ok = !Util.apiBool( this.paramInfo.required ) || this.getApiValue() !== ''; - return $.Deferred().resolve( ok ).promise(); + getValidity: function () { + if ( !Util.apiBool( this.paramInfo.required ) || this.getApiValue() !== '' ) { + return $.Deferred().resolve().promise(); + } else { + return $.Deferred().reject().promise(); + } } }, @@ -372,7 +379,7 @@ } ); widget.setIcon = widget.input.setIcon.bind( widget.input ); widget.setIconTitle = widget.input.setIconTitle.bind( widget.input ); - widget.isValid = widget.input.isValid.bind( widget.input ); + widget.getValidity = widget.input.getValidity.bind( widget.input ); widget.paramInfo = pi; $.extend( widget, WidgetMethods.textInputWidget ); if ( Util.apiBool( pi.enforcerange ) ) { @@ -388,7 +395,7 @@ } ); widget.setIcon = widget.input.setIcon.bind( widget.input ); widget.setIconTitle = widget.input.setIconTitle.bind( widget.input ); - widget.isValid = widget.input.isValid.bind( widget.input ); + widget.getValidity = widget.input.getValidity.bind( widget.input ); widget.input.setValidation( function ( value ) { return value === 'max' || widget.validateNumber( value ); } );