apisandbox.js - rename UploadParamWidget to UploadSelectFileParamWidget

More informative, since it extends SelectFileWidget
Per code review on prior patch

Bug: T269952
Change-Id: I2a579c3b48822f34b378addc586d3cff1e789a48
This commit is contained in:
DannyS712 2020-12-16 17:31:14 +00:00
parent 9000861c13
commit f6863777cc
3 changed files with 11 additions and 11 deletions

View file

@ -1838,7 +1838,7 @@ return [
'packageFiles' => [
'apisandbox.js',
'OptionalParamWidget.js',
'UploadParamWidget.js',
'UploadSelectFileParamWidget.js',
],
'targets' => [ 'desktop', 'mobile' ],
'dependencies' => [

View file

@ -5,23 +5,23 @@
* @private
* @constructor
*/
function UploadParamWidget() {
UploadParamWidget.parent.call( this );
function UploadSelectFileParamWidget() {
UploadSelectFileParamWidget.parent.call( this );
}
OO.inheritClass( UploadParamWidget, OO.ui.SelectFileWidget );
OO.inheritClass( UploadSelectFileParamWidget, OO.ui.SelectFileWidget );
/**
* @return {string}
*/
UploadParamWidget.prototype.getApiValueForDisplay = function () {
UploadSelectFileParamWidget.prototype.getApiValueForDisplay = function () {
return '...';
};
/**
* @return {Mixed}
*/
UploadParamWidget.prototype.getApiValue = function () {
UploadSelectFileParamWidget.prototype.getApiValue = function () {
return this.getValue();
};
@ -29,7 +29,7 @@ UploadParamWidget.prototype.getApiValue = function () {
* There should be `@param {Mixed} newValue` but that results in
* `no-unused-vars` eslint rule failing
*/
UploadParamWidget.prototype.setApiValue = function () {
UploadSelectFileParamWidget.prototype.setApiValue = function () {
// No-op
};
@ -37,11 +37,11 @@ UploadParamWidget.prototype.setApiValue = function () {
* @param {boolean} shouldSuppressErrors
* @return {jQuery.Promise}
*/
UploadParamWidget.prototype.apiCheckValid = function ( shouldSuppressErrors ) {
UploadSelectFileParamWidget.prototype.apiCheckValid = function ( shouldSuppressErrors ) {
var ok = this.getValue() !== null && this.getValue() !== undefined || shouldSuppressErrors;
this.info.setIcon( ok ? null : 'alert' );
this.setTitle( ok ? '' : mw.message( 'apisandbox-alert-field' ).plain() );
return $.Deferred().resolve( ok ).promise();
};
module.exports = UploadParamWidget;
module.exports = UploadSelectFileParamWidget;

View file

@ -13,7 +13,7 @@
moduleInfoCache = {},
baseRequestParams,
OptionalParamWidget = require( './OptionalParamWidget.js' ),
UploadParamWidget = require( './UploadParamWidget.js' );
UploadSelectFileParamWidget = require( './UploadSelectFileParamWidget.js' );
WidgetMethods = {
textInputWidget: {
@ -422,7 +422,7 @@
break;
case 'upload':
widget = new UploadParamWidget();
widget = new UploadSelectFileParamWidget();
widget.paramInfo = pi;
break;