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 ) ) {
|
if ( !Object.prototype.hasOwnProperty.call( cache, name ) ) {
|
||||||
cache[ name ] = factories[ name ]( this );
|
cache[ name ] = factory( this );
|
||||||
}
|
}
|
||||||
|
|
||||||
return cache[ name ];
|
return cache[ name ];
|
||||||
|
|
|
@ -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;
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -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>' )
|
||||||
|
|
|
@ -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();
|
||||||
|
|
|
@ -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
|
|
||||||
);
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
} );
|
} );
|
||||||
|
|
||||||
|
|
|
@ -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() {
|
||||||
|
|
Loading…
Reference in a new issue