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 ) ) { if ( !Object.prototype.hasOwnProperty.call( cache, name ) ) {
cache[ name ] = factories[ name ]( this ); cache[ name ] = factory( this );
} }
return cache[ name ]; return cache[ name ];

View file

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

View file

@ -66,7 +66,7 @@ export function renderReferencePreview(
} ); } );
// We assume elements that benefit from being collapsible are to large for the popup // 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' ) .addClass( 'mwe-collapsible-placeholder' )
.append( .append(
$( '<span>' ) $( '<span>' )

View file

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

View file

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

View file

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