Merge "Rename …ParameterCheckboxLayout now that it's an actual Widget"

This commit is contained in:
jenkins-bot 2021-08-23 14:46:09 +00:00 committed by Gerrit Code Review
commit e803c20007
6 changed files with 19 additions and 21 deletions

View file

@ -19,7 +19,6 @@
{
"name": "User Interface",
"classes": [
"ve.ui.MW*Layout",
"ve.ui.MW*Page",
"ve.ui.MW*Window",
"ve.ui.MWTransclusionsBooklet"

View file

@ -19,7 +19,6 @@
{
"name": "User Interface",
"classes": [
"ve.ui.MW*Layout",
"ve.ui.MW*Page",
"ve.ui.MW*Window",
"ve.ui.MWTransclusionsBooklet"

View file

@ -2156,7 +2156,7 @@
"modules/ve-mw/ui/tools/ve.ui.MWTransclusionDialogTool.js",
"modules/ve-mw/ui/contextitems/ve.ui.MWTransclusionContextItem.js",
"modules/ve-mw/ui/contextitems/ve.ui.MWDefinedTransclusionContextItem.js",
"modules/ve-mw/ui/widgets/ve.ui.MWTemplateOutlineParameterCheckboxLayout.js",
"modules/ve-mw/ui/widgets/ve.ui.MWTransclusionOutlineParameterWidget.js",
"modules/ve-mw/ui/widgets/ve.ui.MWTransclusionOutlineButtonWidget.js",
"modules/ve-mw/ui/widgets/ve.ui.MWTransclusionOutlinePartWidget.js",
"modules/ve-mw/ui/widgets/ve.ui.MWTransclusionOutlineTemplateWidget.js",
@ -2808,7 +2808,7 @@
"lib/ve/tests/ui/inspectors/ve.ui.FragmentInspector.test.js",
"modules/ve-mw/tests/ui/inspectors/ve.ui.FragmentInspector.test.js",
"modules/ve-mw/tests/ui/widgets/ve.ui.MWParameterSearchWidget.test.js",
"modules/ve-mw/tests/ui/widgets/ve.ui.MWTemplateOutlineParameterCheckboxLayout.test.js",
"modules/ve-mw/tests/ui/widgets/ve.ui.MWTransclusionOutlineParameterWidget.test.js",
"modules/ve-mw/tests/ui/widgets/ve.ui.MWTemplateTitleInputWidget.test.js",
"lib/ve/tests/ce/ve.ce.TestRunner.js",
"lib/ve/tests/ce/ve.ce.imetests.test.js",

View file

@ -1,8 +1,8 @@
( function () {
QUnit.module( 've.ui.MWTemplateOutlineParameterCheckboxLayout', ve.test.utils.mwEnvironment );
QUnit.module( 've.ui.MWTransclusionOutlineParameterWidget', ve.test.utils.mwEnvironment );
QUnit.test( 'interprets param with no attributes', ( assert ) => {
const layout = new ve.ui.MWTemplateOutlineParameterCheckboxLayout( {} );
const layout = new ve.ui.MWTransclusionOutlineParameterWidget( {} );
assert.strictEqual( layout.checkbox.isDisabled(), false );
assert.strictEqual( layout.checkbox.isSelected(), false );
@ -10,7 +10,7 @@
} );
QUnit.test( 'interprets required param', ( assert ) => {
const layout = new ve.ui.MWTemplateOutlineParameterCheckboxLayout( { required: true } );
const layout = new ve.ui.MWTransclusionOutlineParameterWidget( { required: true } );
assert.strictEqual( layout.checkbox.isDisabled(), true );
assert.strictEqual( layout.checkbox.isSelected(), true );
@ -18,7 +18,7 @@
} );
QUnit.test( 'interprets selected param', ( assert ) => {
const layout = new ve.ui.MWTemplateOutlineParameterCheckboxLayout( { selected: true } );
const layout = new ve.ui.MWTransclusionOutlineParameterWidget( { selected: true } );
assert.strictEqual( layout.checkbox.isDisabled(), false );
assert.strictEqual( layout.checkbox.isSelected(), true );

View file

@ -1,5 +1,5 @@
/*!
* VisualEditor user interface MWTemplateOutlineParameterCheckboxLayout class.
* VisualEditor user interface MWTransclusionOutlineParameterWidget class.
*
* @license The MIT License (MIT); see LICENSE.txt
*/
@ -17,7 +17,7 @@
* @cfg {boolean} [required]
* @cfg {boolean} [selected]
*/
ve.ui.MWTemplateOutlineParameterCheckboxLayout = function VeUiMWTemplateOutlineParameterCheckboxLayout( config ) {
ve.ui.MWTransclusionOutlineParameterWidget = function VeUiMWTransclusionOutlineParameterWidget( config ) {
this.checkbox = new OO.ui.CheckboxInputWidget( {
title: config.required ? ve.msg( 'visualeditor-dialog-transclusion-required-parameter' ) : null,
disabled: config.required,
@ -28,7 +28,7 @@ ve.ui.MWTemplateOutlineParameterCheckboxLayout = function VeUiMWTemplateOutlineP
this.checkbox.$input.on( 'keydown', this.onKeyDown.bind( this ) );
// Parent constructor
ve.ui.MWTemplateOutlineParameterCheckboxLayout.super.call( this, ve.extendObject( config, {
ve.ui.MWTransclusionOutlineParameterWidget.super.call( this, ve.extendObject( config, {
$label: $( '<label>' )
} ) );
@ -47,8 +47,8 @@ ve.ui.MWTemplateOutlineParameterCheckboxLayout = function VeUiMWTemplateOutlineP
/* Inheritance */
OO.inheritClass( ve.ui.MWTemplateOutlineParameterCheckboxLayout, OO.ui.OptionWidget );
OO.mixinClass( ve.ui.MWTemplateOutlineParameterCheckboxLayout, OO.ui.mixin.TabIndexedElement );
OO.inheritClass( ve.ui.MWTransclusionOutlineParameterWidget, OO.ui.OptionWidget );
OO.mixinClass( ve.ui.MWTransclusionOutlineParameterWidget, OO.ui.mixin.TabIndexedElement );
/* Events */
@ -69,7 +69,7 @@ OO.mixinClass( ve.ui.MWTemplateOutlineParameterCheckboxLayout, OO.ui.mixin.TabIn
* @private
* @fires parameterFocused
*/
ve.ui.MWTemplateOutlineParameterCheckboxLayout.prototype.onClick = function () {
ve.ui.MWTransclusionOutlineParameterWidget.prototype.onClick = function () {
this.selectCheckbox( true );
};
@ -77,7 +77,7 @@ ve.ui.MWTemplateOutlineParameterCheckboxLayout.prototype.onClick = function () {
* @private
* @fires parameterFocused
*/
ve.ui.MWTemplateOutlineParameterCheckboxLayout.prototype.onKeyDown = function ( e ) {
ve.ui.MWTransclusionOutlineParameterWidget.prototype.onKeyDown = function ( e ) {
if ( e.keyCode === OO.ui.Keys.SPACE ) {
// FIXME: Focus should stay in the sidebar
} else if ( e.keyCode === OO.ui.Keys.ENTER ) {
@ -93,7 +93,7 @@ ve.ui.MWTemplateOutlineParameterCheckboxLayout.prototype.onKeyDown = function (
* @param {boolean} value
* @fires parameterSelectionChanged
*/
ve.ui.MWTemplateOutlineParameterCheckboxLayout.prototype.onCheckboxChange = function ( value ) {
ve.ui.MWTransclusionOutlineParameterWidget.prototype.onCheckboxChange = function ( value ) {
this.emit( 'parameterSelectionChanged', this.getData(), value );
};
@ -102,7 +102,7 @@ ve.ui.MWTemplateOutlineParameterCheckboxLayout.prototype.onCheckboxChange = func
* @param {boolean} state Selected state
* @fires parameterFocused
*/
ve.ui.MWTemplateOutlineParameterCheckboxLayout.prototype.selectCheckbox = function ( state ) {
ve.ui.MWTransclusionOutlineParameterWidget.prototype.selectCheckbox = function ( state ) {
if ( !this.checkbox.isDisabled() ) {
this.checkbox.setSelected( state );
}

View file

@ -86,12 +86,12 @@ OO.inheritClass( ve.ui.MWTransclusionOutlineTemplateWidget, ve.ui.MWTransclusion
/**
* @private
* @param {string} paramName
* @return {ve.ui.MWTemplateOutlineParameterCheckboxLayout}
* @return {ve.ui.MWTransclusionOutlineParameterWidget}
*/
ve.ui.MWTransclusionOutlineTemplateWidget.prototype.createCheckbox = function ( paramName ) {
var spec = this.templateModel.getSpec();
return new ve.ui.MWTemplateOutlineParameterCheckboxLayout( {
return new ve.ui.MWTransclusionOutlineParameterWidget( {
required: spec.isParameterRequired( paramName ),
label: spec.getParameterLabel( paramName ),
data: paramName,
@ -104,7 +104,7 @@ ve.ui.MWTransclusionOutlineTemplateWidget.prototype.createCheckbox = function (
/**
* @private
* @param {ve.ui.MWTemplateOutlineParameterCheckboxLayout} checkbox
* @param {ve.ui.MWTransclusionOutlineParameterWidget} checkbox
*/
ve.ui.MWTransclusionOutlineTemplateWidget.prototype.insertCheckboxAtCanonicalPosition = function ( checkbox ) {
var paramName = checkbox.getData(),
@ -170,7 +170,7 @@ ve.ui.MWTransclusionOutlineTemplateWidget.prototype.onRemoveParameter = function
};
/**
* Handles a parameter checkbox change event {@see ve.ui.MWTemplateOutlineParameterCheckboxLayout}
* Handles a parameter checkbox change event {@see ve.ui.MWTransclusionOutlineParameterWidget}
*
* @private
* @param {string} paramName