jenkins-bot has submitted this change and it was merged. ( 
https://gerrit.wikimedia.org/r/363035 )

Change subject: Remove the "Lexeme…" prefix from variable and function names
......................................................................


Remove the "Lexeme…" prefix from variable and function names

It's not so easily possible to rename the widget, because the namespace
must be "jQuery.wikibase.…" because of some reused code in ViewFactory.
I would like to create a "jQuery.wikibase.lexeme.…" namespace for the
jQuery widgets in this component, but this is not possible at the moment.

Change-Id: I4e714c3a5c2e72b70ac6ae8363a4cfae9df4d52b
---
M resources/jquery.wikibase.lexemeview.js
M resources/view/ControllerViewFactory.js
M tests/qunit/jquery.wikibase.lexemeformlistview.tests.js
M tests/qunit/jquery.wikibase.lexemeformview.tests.js
4 files changed, 28 insertions(+), 28 deletions(-)

Approvals:
  Aleksey Bekh-Ivanov (WMDE): Looks good to me, approved
  Jakob: Looks good to me, but someone else must approve
  jenkins-bot: Verified



diff --git a/resources/jquery.wikibase.lexemeview.js 
b/resources/jquery.wikibase.lexemeview.js
index 42a3bbb..a25e388 100644
--- a/resources/jquery.wikibase.lexemeview.js
+++ b/resources/jquery.wikibase.lexemeview.js
@@ -15,7 +15,7 @@
         *
         * @param {Object} options
         * @param {Function} options.buildStatementGroupListView
-        * @param {Function} options.buildLexemeFormListView
+        * @param {Function} options.buildFormListView
         * @param {Function} options.buildSenseListView
         *
         * @constructor
@@ -28,7 +28,7 @@
                 */
                options: {
                        buildStatementGroupListView: null,
-                       buildLexemeFormListView: null,
+                       buildFormListView: null,
                        buildSenseListView: null
                },
 
@@ -50,7 +50,7 @@
                                this.$statements = $( '<div/>' ).appendTo( 
this.$main );
                        }
 
-                       this.options.buildLexemeFormListView();
+                       this.options.buildFormListView();
                        this.options.buildSenseListView();
                },
 
@@ -60,7 +60,7 @@
                 */
                _init: function () {
                        if ( !this.options.buildStatementGroupListView ||
-                               !this.options.buildLexemeFormListView ||
+                               !this.options.buildFormListView ||
                                !this.options.buildSenseListView
                        ) {
                                throw new Error( 'Required option(s) missing' );
diff --git a/resources/view/ControllerViewFactory.js 
b/resources/view/ControllerViewFactory.js
index 67db39b..03bea3d 100644
--- a/resources/view/ControllerViewFactory.js
+++ b/resources/view/ControllerViewFactory.js
@@ -77,7 +77,7 @@
                                buildEntityTermsView: 
this.getEntityTermsView.bind( this, startEditingCallback ),
                                buildSitelinkGroupListView: 
this.getSitelinkGroupListView.bind( this, startEditingCallback ),
                                buildStatementGroupListView: 
this.getStatementGroupListView.bind( this, startEditingCallback ),
-                               buildLexemeFormListView: 
this.getLexemeFormListView.bind( this, lexeme, startEditingCallback ),
+                               buildFormListView: this.getFormListView.bind( 
this, lexeme, startEditingCallback ),
                                buildSenseListView: this.getSenseListView.bind( 
this, lexeme, startEditingCallback ),
                                value: lexeme
                        }
@@ -88,12 +88,12 @@
                return null; // Don't render terms view
        };
 
-       SELF.prototype.getLexemeFormListView = function ( lexeme, 
startEditingCallback ) {
+       SELF.prototype.getFormListView = function ( lexeme, 
startEditingCallback ) {
                return this._getView(
                        'lexemeformlistview',
                        $( '.wikibase-lexeme-forms-section' ),
                        {
-                               getListItemAdapter: 
this.getListItemAdapterForLexemeFormListView.bind( this, lexeme, 
startEditingCallback ),
+                               getListItemAdapter: 
this.getListItemAdapterForFormListView.bind( this, lexeme, startEditingCallback 
),
                                getAdder: this._getAdderWithStartEditing( 
startEditingCallback ),
                                getMessage: $.proxy( mw.messages.get, 
mw.messages ),
                                value: lexeme.forms
@@ -114,7 +114,7 @@
                );
        };
 
-       SELF.prototype.getLexemeFormView = function (
+       SELF.prototype.getFormView = function (
                lexemeId,
                form,
                labelFormattingService,
@@ -122,7 +122,7 @@
                startEditingCallback,
                removeCallback
        ) {
-               var lexemeFormView = this._getView(
+               var formView = this._getView(
                                'lexemeformview',
                                $dom,
                                {
@@ -136,20 +136,20 @@
                                }
                        ),
                        controller = this._getController(
-                               this._toolbarFactory.getToolbarContainer( 
lexemeFormView.element ),
-                               lexemeFormView,
+                               this._toolbarFactory.getToolbarContainer( 
formView.element ),
+                               formView,
                                fakeFormModelCreator( lexemeId ),
-                               removeCallback.bind( null, lexemeFormView ),
+                               removeCallback.bind( null, formView ),
                                form,
                                startEditingCallback
                        );
 
                // Empty formviews (added with the "add" button) should start 
in edit mode
                if ( !form ) {
-                       controller.startEditing().done( 
lexemeFormView.focus.bind( lexemeFormView ) );
+                       controller.startEditing().done( formView.focus.bind( 
formView ) );
                }
 
-               return lexemeFormView;
+               return formView;
        };
 
        function fakeFormModelCreator( lexemeId ) {
@@ -263,7 +263,7 @@
                return deferred.promise();
        };
 
-       SELF.prototype.getListItemAdapterForLexemeFormListView = function ( 
lexeme, startEditingCallback, removeCallback ) {
+       SELF.prototype.getListItemAdapterForFormListView = function ( lexeme, 
startEditingCallback, removeCallback ) {
                var self = this;
 
                return new $.wikibase.listview.ListItemAdapter( {
@@ -271,7 +271,7 @@
                        getNewItem: function ( form, element ) {
                                var $element = $( element );
 
-                               return self.getLexemeFormView(
+                               return self.getFormView(
                                        lexeme.getId(),
                                        form || null,
                                        new FakeLabelFormattingService( 
self._api, self._getExistingGrammaticalFormattedFeatures( $element ) ),
diff --git a/tests/qunit/jquery.wikibase.lexemeformlistview.tests.js 
b/tests/qunit/jquery.wikibase.lexemeformlistview.tests.js
index 4e41216..bff2ac9 100644
--- a/tests/qunit/jquery.wikibase.lexemeformlistview.tests.js
+++ b/tests/qunit/jquery.wikibase.lexemeformlistview.tests.js
@@ -4,7 +4,7 @@
 ( function ( $, wb, QUnit, sinon ) {
        'use strict';
 
-       var lexemeformviewListItemAdapter = wb.tests.getMockListItemAdapter(
+       var formViewListItemAdapter = wb.tests.getMockListItemAdapter(
                'lexemeformview',
                function () {
                }
@@ -14,7 +14,7 @@
                var $node = $( '<div><div 
class="wikibase-lexeme-forms"/></div>' );
                return $node.lexemeformlistview( {
                        getListItemAdapter: function () {
-                               return lexemeformviewListItemAdapter;
+                               return formViewListItemAdapter;
                        },
                        getAdder: getAdder || function () {},
                        getMessage: message || function () { return 'localize 
me'; }
@@ -39,7 +39,7 @@
 
        QUnit.test( 'enterNewItem adds new list item', function ( assert ) {
                var view = newView(),
-                       listItemAdapterSpy = sinon.spy( 
lexemeformviewListItemAdapter, 'newListItem' );
+                       listItemAdapterSpy = sinon.spy( 
formViewListItemAdapter, 'newListItem' );
 
                assert.notOk( listItemAdapterSpy.called );
 
diff --git a/tests/qunit/jquery.wikibase.lexemeformview.tests.js 
b/tests/qunit/jquery.wikibase.lexemeformview.tests.js
index 757db78..6024d38 100644
--- a/tests/qunit/jquery.wikibase.lexemeformview.tests.js
+++ b/tests/qunit/jquery.wikibase.lexemeformview.tests.js
@@ -23,7 +23,7 @@
                }
        } ) );
 
-       var newLexemeFormView = function ( options ) {
+       var newFormView = function ( options ) {
                var $node = $( '<div/>' ).appendTo( '#qunit-fixture' );
 
                options = options || {};
@@ -47,12 +47,12 @@
        };
 
        QUnit.test( 'can be created', function ( assert ) {
-               assert.ok( newLexemeFormView() instanceof 
$.wikibase.lexemeformview );
+               assert.ok( newFormView() instanceof $.wikibase.lexemeformview );
        } );
 
        QUnit.test( 'value can be injected as option.value', function ( assert 
) {
                var form = newForm( 'F123', 'foo' ),
-                       view = newLexemeFormView( {
+                       view = newFormView( {
                                value: form
                        } );
 
@@ -62,7 +62,7 @@
        QUnit.test( 'value() sets internal value', function ( assert ) {
                var form1 = newForm( 'F123', 'foo' ),
                        form2 = newForm( 'F234', 'bar' ),
-                       view = newLexemeFormView( {
+                       view = newFormView( {
                                value: form1
                        } );
 
@@ -72,7 +72,7 @@
 
        QUnit.test( 'value() creates value from input if it is in edit mode', 
function ( assert ) {
                var done = assert.async();
-               var view = newLexemeFormView(),
+               var view = newFormView(),
                        textInput = 'foobar';
 
                view.startEditing().then( function () {
@@ -89,17 +89,17 @@
        } );
 
        QUnit.test( 'should not be in edit mode when initialized without a 
value', function ( assert ) {
-               assert.notOk( newLexemeFormView().isInEditMode() );
+               assert.notOk( newFormView().isInEditMode() );
        } );
 
        QUnit.test( 'should not be in edit mode by default when initialized 
with a value', function ( assert ) {
-               assert.notOk( newLexemeFormView( { value: newForm( 'F123', 
'foo' ) } ).isInEditMode() );
+               assert.notOk( newFormView( { value: newForm( 'F123', 'foo' ) } 
).isInEditMode() );
        } );
 
        QUnit.test( 'draws value in input node after startEditing()', function 
( assert ) {
                var done = assert.async();
                var form = newForm( 'F123', 'foobar' ),
-                       view = newLexemeFormView( {
+                       view = newFormView( {
                                value: form
                        } );
 
@@ -118,7 +118,7 @@
                var done = assert.async();
 
                var form = newForm( 'F123', 'foobar' ),
-                       view = newLexemeFormView( {
+                       view = newFormView( {
                                value: form
                        } );
 

-- 
To view, visit https://gerrit.wikimedia.org/r/363035
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I4e714c3a5c2e72b70ac6ae8363a4cfae9df4d52b
Gerrit-PatchSet: 4
Gerrit-Project: mediawiki/extensions/WikibaseLexeme
Gerrit-Branch: master
Gerrit-Owner: Thiemo Mättig (WMDE) <[email protected]>
Gerrit-Reviewer: Aleksey Bekh-Ivanov (WMDE) <[email protected]>
Gerrit-Reviewer: Jakob <[email protected]>
Gerrit-Reviewer: Jonas Kress (WMDE) <[email protected]>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to