mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/Popups
synced 2024-11-23 23:24:39 +00:00
Minor code cleanups, e.g. utilizing arrow functions
Change-Id: I56bcfa040553a96f018f22483f3f988c5639fc97
This commit is contained in:
parent
7d2de31fd9
commit
c1abe80b08
BIN
resources/dist/index.js
vendored
BIN
resources/dist/index.js
vendored
Binary file not shown.
BIN
resources/dist/index.js.map.json
vendored
BIN
resources/dist/index.js.map.json
vendored
Binary file not shown.
|
@ -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 ];
|
||||
|
|
|
@ -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';
|
||||
}
|
||||
|
|
|
@ -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>' )
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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 );
|
||||
}
|
||||
} );
|
||||
|
||||
|
|
|
@ -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() {
|
||||
|
|
Loading…
Reference in a new issue