Minor code cleanups, e.g. utilizing arrow functions

Change-Id: I56bcfa040553a96f018f22483f3f988c5639fc97
This commit is contained in:
Thiemo Kreuz 2020-10-29 15:33:53 +01:00 committed by Adam Wight
parent 7d2de31fd9
commit c1abe80b08
8 changed files with 8 additions and 27 deletions

Binary file not shown.

Binary file not shown.

View file

@ -83,7 +83,7 @@ export default function createContainer() {
}
if ( !Object.prototype.hasOwnProperty.call( cache, name ) ) {
cache[ name ] = factories[ name ]( this );
cache[ name ] = factory( this );
}
return cache[ name ];

View file

@ -23,16 +23,7 @@ export function isEnabled( user, config, window ) {
return true;
}
if ( !config.get( 'wgPopupsEventLogging' ) ) {
return false;
}
if (
!window.navigator ||
typeof window.navigator.sendBeacon !== 'function'
) {
return false;
}
return true;
return config.get( 'wgPopupsEventLogging' ) &&
window.navigator &&
typeof window.navigator.sendBeacon === 'function';
}

View file

@ -66,7 +66,7 @@ export function renderReferencePreview(
} );
// We assume elements that benefit from being collapsible are to large for the popup
$el.find( '.mw-collapsible' ).replaceWith( () => $( '<div>' )
$el.find( '.mw-collapsible' ).replaceWith( $( '<div>' )
.addClass( 'mwe-collapsible-placeholder' )
.append(
$( '<span>' )

View file

@ -32,9 +32,7 @@ QUnit.module( 'ext.popups/changeListeners/footerLink @integration', {
this.footerLinkChangeListener( undefined, this.state );
};
this.getLink = function () {
return this.$footer.find( 'li:last-child' );
};
this.getLink = () => this.$footer.find( 'li:last-child' );
},
afterEach() {
this.$footer.remove();

View file

@ -15,13 +15,7 @@ QUnit.module( 'ext.popups/instrumentation/eventLogging', {
this.user = stubs.createStubUser();
// Helper function that DRYs up the tests below.
this.isEnabled = function () {
return isEnabled(
this.user,
this.config,
this.window
);
};
this.isEnabled = () => isEnabled( this.user, this.config, this.window );
}
} );

View file

@ -59,9 +59,7 @@ class PopupsPage extends Page {
}
hasReferencePopupsEnabled() {
return browser.execute( function () {
return mw.config.get( 'wgPopupsReferencePreviews' );
} );
return browser.execute( () => mw.config.get( 'wgPopupsReferencePreviews' ) );
}
abandonLink() {