Esanders has uploaded a new change for review. (
https://gerrit.wikimedia.org/r/327184 )
Change subject: build: Replace jshint/jscs with eslint
......................................................................
build: Replace jshint/jscs with eslint
Change-Id: I423add157245353031e36b7e44fee7ace7c753c7
---
A .eslintrc.json
D .jscsrc
D .jshintignore
D .jshintrc
M Gruntfile.js
M package.json
M resources/mmv/logging/mmv.logging.ActionLogger.js
M resources/mmv/logging/mmv.logging.DurationLogger.js
M resources/mmv/mmv.Config.js
M resources/mmv/mmv.EmbedFileFormatter.js
M resources/mmv/mmv.bootstrap.js
M resources/mmv/mmv.js
M resources/mmv/mmv.lightboximage.js
M resources/mmv/model/mmv.model.IwTitle.js
M resources/mmv/model/mmv.model.Repo.js
M resources/mmv/provider/mmv.provider.Api.js
M resources/mmv/provider/mmv.provider.GuessedThumbnailInfo.js
M resources/mmv/provider/mmv.provider.Image.js
M resources/mmv/ui/mmv.ui.canvas.js
M resources/mmv/ui/mmv.ui.canvasButtons.js
M resources/mmv/ui/mmv.ui.dialog.js
M resources/mmv/ui/mmv.ui.download.pane.js
M resources/mmv/ui/mmv.ui.js
M resources/mmv/ui/mmv.ui.metadataPanel.js
M resources/mmv/ui/mmv.ui.metadataPanelScroller.js
M resources/mmv/ui/mmv.ui.reuse.dialog.js
M resources/mmv/ui/mmv.ui.reuse.embed.js
M resources/mmv/ui/mmv.ui.reuse.tab.js
M resources/mmv/ui/mmv.ui.stripeButtons.js
M resources/mmv/ui/mmv.ui.tipsyDialog.js
M resources/mmv/ui/mmv.ui.viewingOptions.js
M tests/qunit/mmv/mmv.bootstrap.test.js
M tests/qunit/mmv/mmv.testhelpers.js
M tests/qunit/mmv/routing/mmv.routing.Router.test.js
M tests/qunit/mmv/ui/mmv.ui.metadataPanel.test.js
M tests/qunit/mmv/ui/mmv.ui.metadataPanelScroller.test.js
M tests/qunit/mmv/ui/mmv.ui.reuse.dialog.test.js
M tests/qunit/mmv/ui/mmv.ui.reuse.embed.test.js
M tests/qunit/mmv/ui/mmv.ui.reuse.utils.test.js
M tests/qunit/mmv/ui/mmv.ui.stripeButtons.test.js
40 files changed, 240 insertions(+), 226 deletions(-)
git pull
ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/MultimediaViewer
refs/changes/84/327184/1
diff --git a/.eslintrc.json b/.eslintrc.json
new file mode 100644
index 0000000..488ab05
--- /dev/null
+++ b/.eslintrc.json
@@ -0,0 +1,15 @@
+{
+ "extends": "wikimedia",
+ "env": {
+ "browser": true,
+ "jquery": true,
+ "qunit": true
+ },
+ "globals": {
+ "OO": false,
+ "mediaWiki": false
+ },
+ "rules": {
+ "dot-notation": [ "error", { "allowKeywords": true } ]
+ }
+}
diff --git a/.jscsrc b/.jscsrc
deleted file mode 100644
index 831de1c..0000000
--- a/.jscsrc
+++ /dev/null
@@ -1,20 +0,0 @@
-{
- "preset": "wikimedia",
-
- "jsDoc": {
- "checkAnnotations": {
- "preset": "jsduck5",
- "extra": {
- "source": true,
- "see": true
- }
- },
- "checkParamNames": true,
- "checkRedundantAccess": true,
- "checkRedundantReturns": true,
- "checkTypes": "strictNativeCase",
- "requireNewlineAfterDescription": true,
- "requireParamTypes": true,
- "requireReturnTypes": true
- }
-}
\ No newline at end of file
diff --git a/.jshintignore b/.jshintignore
deleted file mode 100644
index bc13f20..0000000
--- a/.jshintignore
+++ /dev/null
@@ -1,3 +0,0 @@
-resources/jquery.scrollTo
-resources/jquery.hashchange
-docs/js/*
diff --git a/.jshintrc b/.jshintrc
deleted file mode 100644
index acd2da2..0000000
--- a/.jshintrc
+++ /dev/null
@@ -1,28 +0,0 @@
-{
- // Enforcing
- "bitwise": true,
- "eqeqeq": true,
- "freeze": true,
- "latedef": "nofunc",
- "esversion": "3",
- "futurehostile": true,
- "noarg": true,
- "nonew": true,
- "undef": true,
- "unused": true,
-
- "strict": false,
-
- // Relaxing
-
- // Environment
- "browser": true,
- "jquery": true,
-
- "globals": {
- "mediaWiki": false,
- "OO": false,
- "QUnit": false,
- "moment": false
- }
-}
diff --git a/Gruntfile.js b/Gruntfile.js
index e667255..2404b9a 100644
--- a/Gruntfile.js
+++ b/Gruntfile.js
@@ -1,8 +1,8 @@
-/*jshint node:true */
+/* eslint-env node */
+
module.exports = function ( grunt ) {
grunt.loadNpmTasks( 'grunt-banana-checker' );
- grunt.loadNpmTasks( 'grunt-jscs' );
- grunt.loadNpmTasks( 'grunt-contrib-jshint' );
+ grunt.loadNpmTasks( 'grunt-eslint' );
grunt.loadNpmTasks( 'grunt-jsonlint' );
grunt.loadNpmTasks( 'grunt-stylelint' );
@@ -16,26 +16,12 @@
'!node_modules/**'
]
},
- jshint: {
- options: {
- jshintrc: true
- },
+ eslint: {
all: [
'*.js',
'resources/mmv/**/*.js',
'tests/**/*.js'
]
- },
- jscs: {
- fix: {
- options: {
- fix: true
- },
- src: '<%= jshint.all %>'
- },
- main: {
- src: '<%= jshint.all %>'
- }
},
stylelint: {
options: {
@@ -45,6 +31,6 @@
}
} );
- grunt.registerTask( 'test', [ 'jshint', 'jscs:main', 'stylelint',
'jsonlint', 'banana' ] );
+ grunt.registerTask( 'test', [ 'eslint', 'stylelint', 'jsonlint',
'banana' ] );
grunt.registerTask( 'default', 'test' );
};
diff --git a/package.json b/package.json
index fd369c2..fff82ba 100644
--- a/package.json
+++ b/package.json
@@ -5,12 +5,12 @@
"doc": "jsduck"
},
"devDependencies": {
+ "eslint-config-wikimedia": "0.3.0",
"grunt": "1.0.1",
"grunt-banana-checker": "0.5.0",
- "grunt-contrib-jshint": "1.0.0",
- "grunt-jscs": "2.8.0",
+ "grunt-eslint": "19.0.0",
"grunt-jsonlint": "1.0.8",
- "grunt-stylelint": "^0.6.0",
- "stylelint-config-wikimedia": "^0.3.0"
+ "grunt-stylelint": "0.6.0",
+ "stylelint-config-wikimedia": "0.3.0"
}
}
diff --git a/resources/mmv/logging/mmv.logging.ActionLogger.js
b/resources/mmv/logging/mmv.logging.ActionLogger.js
index ff42433..9f18f97 100644
--- a/resources/mmv/logging/mmv.logging.ActionLogger.js
+++ b/resources/mmv/logging/mmv.logging.ActionLogger.js
@@ -156,7 +156,7 @@
* @return {number} Sampling factor
*/
L.getActionFactor = function ( action ) {
- return this.samplingFactorMap[ action ] ||
this.samplingFactorMap[ 'default' ];
+ return this.samplingFactorMap[ action ] ||
this.samplingFactorMap.default;
};
/**
diff --git a/resources/mmv/logging/mmv.logging.DurationLogger.js
b/resources/mmv/logging/mmv.logging.DurationLogger.js
index 4076fa8..726eaa5 100644
--- a/resources/mmv/logging/mmv.logging.DurationLogger.js
+++ b/resources/mmv/logging/mmv.logging.DurationLogger.js
@@ -51,10 +51,12 @@
*/
L.schema = 'MultimediaViewerDuration';
+ // eslint-disable-next-line valid-jsdoc
/**
* Saves the start of a duration
*
* @param {string|string[]} typeOrTypes Type(s) of duration being
measured.
+ * @chainable
*/
L.start = function ( typeOrTypes ) {
var i,
@@ -78,11 +80,13 @@
return this;
};
+ // eslint-disable-next-line valid-jsdoc
/**
* Saves the stop of a duration
*
* @param {string} type Type of duration being measured.
* @param {number} start Start timestamp to substitute the one coming
from start()
+ * @chainable
*/
L.stop = function ( type, start ) {
var stop = $.now();
@@ -104,11 +108,13 @@
return this;
};
+ // eslint-disable-next-line valid-jsdoc
/**
* Records the duration log event
*
* @param {string} type Type of duration being measured.
* @param {Object} extraData Extra information to add to the log event
data
+ * @chainable
*/
L.record = function ( type, extraData ) {
var e, duration;
diff --git a/resources/mmv/mmv.Config.js b/resources/mmv/mmv.Config.js
index a2fe6b2..10cdc6e 100644
--- a/resources/mmv/mmv.Config.js
+++ b/resources/mmv/mmv.Config.js
@@ -19,9 +19,14 @@
var CP;
/**
- * @class mw.mmv.Config
* Contains/retrieves configuration/environment information for
MediaViewer.
+ * @class mw.mmv.Config
* @constructor
+ * @param {Object} viewerConfig
+ * @param {mw.Map} mwConfig
+ * @param {Object} mwUser
+ * @param {mw.Api} api
+ * @param {Object} localStorage
*/
function Config( viewerConfig, mwConfig, mwUser, api, localStorage ) {
/**
@@ -131,6 +136,8 @@
/**
* Returns true if MediaViewer should handle thumbnail clicks.
+ *
+ * @return {boolean}
*/
CP.isMediaViewerEnabledOnClick = function () {
// IMPORTANT: mmv.head.js uses the same logic but does not use
this class to be lightweight. Make sure to keep it in sync.
@@ -215,7 +222,7 @@
*
* @private
*/
- CP.maybeEnableStatusInfo = function ( ) {
+ CP.maybeEnableStatusInfo = function () {
var currentShowStatusInfo = this.getFromLocalStorage(
'mmv-showStatusInfo' );
if ( currentShowStatusInfo === null ) {
this.setInLocalStorage( 'mmv-showStatusInfo', '1' );
@@ -225,7 +232,7 @@
/**
* Called when status info is displayed. Future shouldShowStatusInfo()
calls will retrurn false.
*/
- CP.disableStatusInfo = function ( ) {
+ CP.disableStatusInfo = function () {
this.setInLocalStorage( 'mmv-showStatusInfo', '0' );
};
@@ -238,7 +245,7 @@
*
* @return {Object}
*/
- CP.extensions = function ( ) {
+ CP.extensions = function () {
return this.viewerConfig.extensions;
};
@@ -247,7 +254,7 @@
*
* @return {string} Language code
*/
- CP.language = function ( ) {
+ CP.language = function () {
return this.mwConfig.get( 'wgUserLanguage', false ) ||
this.mwConfig.get( 'wgContentLanguage', 'en' );
};
@@ -256,7 +263,7 @@
*
* @return {string|boolean} URI
*/
- CP.recordVirtualViewBeaconURI = function ( ) {
+ CP.recordVirtualViewBeaconURI = function () {
return this.viewerConfig.recordVirtualViewBeaconURI;
};
@@ -265,7 +272,7 @@
*
* @return {boolean}
*/
- CP.useThumbnailGuessing = function ( ) {
+ CP.useThumbnailGuessing = function () {
return this.viewerConfig.useThumbnailGuessing;
};
@@ -274,7 +281,7 @@
*
* @return {string|boolean}
*/
- CP.imageQueryParameter = function ( ) {
+ CP.imageQueryParameter = function () {
return this.viewerConfig.imageQueryParameter;
};
diff --git a/resources/mmv/mmv.EmbedFileFormatter.js
b/resources/mmv/mmv.EmbedFileFormatter.js
index e0cdc06..735173b 100644
--- a/resources/mmv/mmv.EmbedFileFormatter.js
+++ b/resources/mmv/mmv.EmbedFileFormatter.js
@@ -240,6 +240,7 @@
* Generate a link which we will be using for sharing stuff.
*
* @param {mw.mmv.model.EmbedFileInfo} info
+ * @return {string} URL
*/
EFFP.getLinkUrl = function ( info ) {
var route = new mw.mmv.routing.ThumbnailRoute(
info.imageInfo.title );
diff --git a/resources/mmv/mmv.bootstrap.js b/resources/mmv/mmv.bootstrap.js
index 978ad6d..38719f0 100644
--- a/resources/mmv/mmv.bootstrap.js
+++ b/resources/mmv/mmv.bootstrap.js
@@ -130,6 +130,8 @@
/**
* Processes all thumbs found on the page
+ *
+ * @param {jQuery} $content Element to search for thumbs
*/
MMVB.processThumbs = function ( $content ) {
var bs = this;
@@ -378,6 +380,7 @@
*
* @param {HTMLElement} element Clicked element
* @param {string} title File title
+ * @return {jQuery.Promise}
*/
MMVB.openImage = function ( element, title ) {
var $element = $( element );
diff --git a/resources/mmv/mmv.js b/resources/mmv/mmv.js
index 7c35812..21adca8 100644
--- a/resources/mmv/mmv.js
+++ b/resources/mmv/mmv.js
@@ -696,6 +696,8 @@
/**
* Preload the fullscreen size of the current image.
+ *
+ * @param {mw.mmv.LightboxImage} image
*/
MMVP.preloadFullscreenThumbnail = function ( image ) {
var imageWidths =
this.ui.canvas.getLightboxImageWidthsForFullscreen( image ),
diff --git a/resources/mmv/mmv.lightboximage.js
b/resources/mmv/mmv.lightboximage.js
index 6366f7e..865666d 100644
--- a/resources/mmv/mmv.lightboximage.js
+++ b/resources/mmv/mmv.lightboximage.js
@@ -28,6 +28,7 @@
* @param {number} index Which number file this is
* @param {HTMLImageElement} thumb The thumbnail that represents this
image on the page
* @param {string} [caption] The caption, if any.
+ * @param {string} [alt] The alt text of the image
*/
function LightboxImage( fileLink, filePageLink, fileTitle, index,
thumb, caption, alt ) {
/** @property {string} Link to the file - generally a thumb URL
*/
diff --git a/resources/mmv/model/mmv.model.IwTitle.js
b/resources/mmv/model/mmv.model.IwTitle.js
index 7298025..046cbf9 100644
--- a/resources/mmv/model/mmv.model.IwTitle.js
+++ b/resources/mmv/model/mmv.model.IwTitle.js
@@ -54,6 +54,7 @@
* Copy of the private function in mw.Title.
*
* @param {string} s
+ * @return {string}
*/
function text( s ) {
return s ? s.replace( /_/g, ' ' ) : '';
diff --git a/resources/mmv/model/mmv.model.Repo.js
b/resources/mmv/model/mmv.model.Repo.js
index b435c6b..f807810 100644
--- a/resources/mmv/model/mmv.model.Repo.js
+++ b/resources/mmv/model/mmv.model.Repo.js
@@ -15,6 +15,8 @@
* along with MultimediaViewer. If not, see <http://www.gnu.org/licenses/>.
*/
+/* eslint-disable no-use-before-define */
+
( function ( mw, oo ) {
/**
* Represents information about a single image repository
diff --git a/resources/mmv/provider/mmv.provider.Api.js
b/resources/mmv/provider/mmv.provider.Api.js
index 843a90d..b1b209b 100644
--- a/resources/mmv/provider/mmv.provider.Api.js
+++ b/resources/mmv/provider/mmv.provider.Api.js
@@ -62,6 +62,7 @@
*
* @param {string} key cache key
* @param {function(): jQuery.Promise} getPromise a function to get the
promise on cache miss
+ * @return {jQuery.Promise}
*/
Api.prototype.getCachedPromise = function ( key, getPromise ) {
var provider = this;
diff --git a/resources/mmv/provider/mmv.provider.GuessedThumbnailInfo.js
b/resources/mmv/provider/mmv.provider.GuessedThumbnailInfo.js
index 03002c3..d81e15c 100644
--- a/resources/mmv/provider/mmv.provider.GuessedThumbnailInfo.js
+++ b/resources/mmv/provider/mmv.provider.GuessedThumbnailInfo.js
@@ -124,6 +124,7 @@
* @param {mw.Title} file
* @param {number} width thumbnail width in pixels
* @param {number} originalWidth width of original image in pixels
+ * @return {boolean}
*/
GuessedThumbnailInfo.prototype.needsOriginal = function ( file, width,
originalWidth ) {
return width >= originalWidth &&
!this.canHaveLargerThumbnailThanOriginal( file );
@@ -135,6 +136,7 @@
* @protected
* @param {string} url a thumbnail URL
* @param {mw.Title} file
+ * @return {boolean}
*/
GuessedThumbnailInfo.prototype.isFullSizeUrl = function ( url, file ) {
return !this.obscureFilename( url, file ).match( '/thumb/' );
@@ -292,8 +294,7 @@
* @param {number} width thumbnail width in pixels
* @return {string|undefined} thumbnail URL
*/
- GuessedThumbnailInfo.prototype.guessThumbUrl = function ( file,
originalUrl, width ) {
- /* jshint unused:false */
+ GuessedThumbnailInfo.prototype.guessThumbUrl = function () {
// Not implemented. This can be very complicated (the thumbnail
might have other
// parameters than the size, which are impossible to guess,
might be converted to some
// other format, might have a special shortened format
depending on the length of the
diff --git a/resources/mmv/provider/mmv.provider.Image.js
b/resources/mmv/provider/mmv.provider.Image.js
index 21692d3..9a20edf 100644
--- a/resources/mmv/provider/mmv.provider.Image.js
+++ b/resources/mmv/provider/mmv.provider.Image.js
@@ -137,8 +137,11 @@
/**
* Checks whether the current browser needs to set crossOrigin on
images to avoid
* doing a double load
+ *
+ * @return {boolean} Browser needs to set crossOrigin
*/
Image.prototype.needsCrossOrigin = function () {
+ // Support: IE11
// This check is essentially "is this browser anything but IE >
10?".
// I couldn't find something more topical because IE11 does
support the crossOrigin
// attribute, just in a counter-productive way compared to all
the other browsers
diff --git a/resources/mmv/ui/mmv.ui.canvas.js
b/resources/mmv/ui/mmv.ui.canvas.js
index 67ed7ed..61d3362 100644
--- a/resources/mmv/ui/mmv.ui.canvas.js
+++ b/resources/mmv/ui/mmv.ui.canvas.js
@@ -150,6 +150,8 @@
/**
* Handles a "dialog open/close" event from dialogs on the page.
+ *
+ * @param {jQuery.Event} e
*/
C.handleDialogEvent = function ( e ) {
switch ( e.type ) {
diff --git a/resources/mmv/ui/mmv.ui.canvasButtons.js
b/resources/mmv/ui/mmv.ui.canvasButtons.js
index cd8f1a1..762f737 100644
--- a/resources/mmv/ui/mmv.ui.canvasButtons.js
+++ b/resources/mmv/ui/mmv.ui.canvasButtons.js
@@ -185,6 +185,8 @@
/**
* Reveals all active buttons and schedule a fade out if needed
+ *
+ * @param {Object} [mousePosition] Mouse position containing 'x' and
'y' properties
*/
CBP.revealAndFade = function ( mousePosition ) {
if ( this.buttonsFadeTimeout ) {
diff --git a/resources/mmv/ui/mmv.ui.dialog.js
b/resources/mmv/ui/mmv.ui.dialog.js
index c8db681..5762901 100644
--- a/resources/mmv/ui/mmv.ui.dialog.js
+++ b/resources/mmv/ui/mmv.ui.dialog.js
@@ -65,8 +65,9 @@
/**
* Handles click on link that opens/closes the dialog.
*
- * @param {Event} openEvent Event object for the mmv-$dialog-open event.
- * @param {Event} e Event object for the click event.
+ * @param {jQuery.Event} openEvent Event object for the
mmv-$dialog-open event.
+ * @param {jQuery.Event} e Event object for the click event.
+ * @return {boolean} False to cancel the default event
*/
DP.handleOpenCloseClick = function ( openEvent, e ) {
var dialog = this;
@@ -86,7 +87,7 @@
/**
* Toggles the open state on the dialog.
*
- * @param {Event} [e] Event object when the close action is caused by a
user
+ * @param {jQuery.Event} [e] Event object when the close action is
caused by a user
* action, as opposed to closing the window or something.
*/
DP.toggleDialog = function ( e ) {
diff --git a/resources/mmv/ui/mmv.ui.download.pane.js
b/resources/mmv/ui/mmv.ui.download.pane.js
index 7ee519f..b9f087d 100644
--- a/resources/mmv/ui/mmv.ui.download.pane.js
+++ b/resources/mmv/ui/mmv.ui.download.pane.js
@@ -334,7 +334,8 @@
/**
* Chops off the extension part of an URL.
*
- * @param {string} url
+ * @param {string} url URL
+ * @return {string} Extension
*/
DP.getExtensionFromUrl = function ( url ) {
var urlParts = url.split( '.' );
@@ -370,8 +371,8 @@
}
attributionCtaMessage = ( license && license.needsAttribution()
) ?
- 'multimediaviewer-download-attribution-cta-header'
- :
'multimediaviewer-download-optional-attribution-cta-header';
+ 'multimediaviewer-download-attribution-cta-header' :
+
'multimediaviewer-download-optional-attribution-cta-header';
this.$attributionCtaHeader.text( mw.message(
attributionCtaMessage ).text() );
this.$attributionHowHeader.text( mw.message(
attributionCtaMessage ).text() );
};
diff --git a/resources/mmv/ui/mmv.ui.js b/resources/mmv/ui/mmv.ui.js
index 6b264a6..e498e80 100644
--- a/resources/mmv/ui/mmv.ui.js
+++ b/resources/mmv/ui/mmv.ui.js
@@ -228,6 +228,9 @@
* Reduces the action of clicks to solely focusing the input/textarea.
* Essentialy disables clicking inside the text to select a portion of
it.
* Invoked with that input/textarea as context.
+ *
+ * @param {jQuery.Event} e
+ * @return {boolean} False to prevent default event
*/
EP.onlyFocus = function ( e ) {
this.focus();
diff --git a/resources/mmv/ui/mmv.ui.metadataPanel.js
b/resources/mmv/ui/mmv.ui.metadataPanel.js
index 05ed72c..e8d830d 100644
--- a/resources/mmv/ui/mmv.ui.metadataPanel.js
+++ b/resources/mmv/ui/mmv.ui.metadataPanel.js
@@ -60,6 +60,8 @@
/**
* FIXME this should be in the jquery.fullscreen plugin.
+ *
+ * @return {boolean}
*/
MPP.isFullscreened = function () {
return $( this.$container ).closest( '.jq-fullscreened'
).length > 0;
@@ -731,8 +733,7 @@
).text()
);
- $.each( mw.language.data, function ( key, value ) {
- value = 'go away jshint';
+ $.each( mw.language.data, function ( key ) {
language = key;
return false;
} );
@@ -826,6 +827,7 @@
date;
mw.loader.using( 'moment', function () {
+ /* global moment */
date = moment( dateString );
if ( date.isValid() ) {
diff --git a/resources/mmv/ui/mmv.ui.metadataPanelScroller.js
b/resources/mmv/ui/mmv.ui.metadataPanelScroller.js
index 48f89e0..ed24988 100644
--- a/resources/mmv/ui/mmv.ui.metadataPanelScroller.js
+++ b/resources/mmv/ui/mmv.ui.metadataPanelScroller.js
@@ -200,6 +200,8 @@
/**
* Handles keydown events for this element.
+ *
+ * @param {jQuery.Event} e Key down event
*/
MPSP.keydown = function ( e ) {
if ( e.altKey || e.shiftKey || e.ctrlKey || e.metaKey ) {
diff --git a/resources/mmv/ui/mmv.ui.reuse.dialog.js
b/resources/mmv/ui/mmv.ui.reuse.dialog.js
index 590398b..b33b458 100644
--- a/resources/mmv/ui/mmv.ui.reuse.dialog.js
+++ b/resources/mmv/ui/mmv.ui.reuse.dialog.js
@@ -116,6 +116,8 @@
/**
* Handles tab selection.
+ *
+ * @param {OO.ui.MenuOptionWidget} option
*/
DP.handleTabSelection = function ( option ) {
var tab;
@@ -134,7 +136,7 @@
};
/**
- *
+ * @return {string} Last used tab
*/
DP.getLastUsedTab = function () {
return this.config.getFromLocalStorage( 'mmv-lastUsedTab' );
diff --git a/resources/mmv/ui/mmv.ui.reuse.embed.js
b/resources/mmv/ui/mmv.ui.reuse.embed.js
index 0aeacec..ed91338 100644
--- a/resources/mmv/ui/mmv.ui.reuse.embed.js
+++ b/resources/mmv/ui/mmv.ui.reuse.embed.js
@@ -510,7 +510,7 @@
}
}
- sizes[ 'default' ] = { width: null, height: null };
+ sizes.default = { width: null, height: null };
return sizes;
};
diff --git a/resources/mmv/ui/mmv.ui.reuse.tab.js
b/resources/mmv/ui/mmv.ui.reuse.tab.js
index 98298eb..74735c0 100644
--- a/resources/mmv/ui/mmv.ui.reuse.tab.js
+++ b/resources/mmv/ui/mmv.ui.reuse.tab.js
@@ -27,7 +27,7 @@
* @constructor
*/
function Tab( $container ) {
- Tab[ 'super' ].call( this, $container );
+ Tab.super.call( this, $container );
/**
* Container for the tab.
diff --git a/resources/mmv/ui/mmv.ui.stripeButtons.js
b/resources/mmv/ui/mmv.ui.stripeButtons.js
index cb2c461..ba052ec 100644
--- a/resources/mmv/ui/mmv.ui.stripeButtons.js
+++ b/resources/mmv/ui/mmv.ui.stripeButtons.js
@@ -19,10 +19,11 @@
var SBP;
/**
- * @class mw.mmv.ui.StripeButtons
- * @extends mw.mmv.ui.Element
* Class for buttons which are placed on the metadata stripe (the
always visible part of the
* metadata panel).
+ *
+ * @class mw.mmv.ui.StripeButtons
+ * @extends mw.mmv.ui.Element
* @constructor
* @param {jQuery} $container the title block (.mw-mmv-title-contain)
which wraps the buttons and all
* other title elements
@@ -50,6 +51,7 @@
*
* @protected
* @param {string} cssClass CSS class name for the button
+ * @return {jQuery} Button
*/
SBP.createButton = function ( cssClass ) {
var $button;
diff --git a/resources/mmv/ui/mmv.ui.tipsyDialog.js
b/resources/mmv/ui/mmv.ui.tipsyDialog.js
index 0d5836c..8202d5e 100644
--- a/resources/mmv/ui/mmv.ui.tipsyDialog.js
+++ b/resources/mmv/ui/mmv.ui.tipsyDialog.js
@@ -24,8 +24,8 @@
* @class mw.mmv.ui.TipsyDialog
* @extends mw.mmv.ui.Element
* @constructor
- * @property {jQuery} $anchor the element to which the popup is
anchored.
- * @property {Object} options takes any tipsy option - see
+ * @param {jQuery} $anchor the element to which the popup is anchored.
+ * @param {Object} options takes any tipsy option - see
*
https://github.com/jaz303/tipsy/blob/master/docs/src/index.html.erb#L298
*/
function TipsyDialog( $anchor, options ) {
@@ -90,6 +90,7 @@
*
* @private
* @param {Object} originalOptions
+ * @return {Object} Preprocessed options
*/
TDP.getPreprocessedOptions = function ( originalOptions ) {
var options = $.extend( {}, originalOptions );
@@ -168,6 +169,8 @@
/**
* @private
+ * @param {string} [title]
+ * @param {string} [body]
* @return {string}
*/
TDP.generateContent = function ( title, body ) {
diff --git a/resources/mmv/ui/mmv.ui.viewingOptions.js
b/resources/mmv/ui/mmv.ui.viewingOptions.js
index cb64e7e..4966bc0 100644
--- a/resources/mmv/ui/mmv.ui.viewingOptions.js
+++ b/resources/mmv/ui/mmv.ui.viewingOptions.js
@@ -188,6 +188,10 @@
/**
* Creates a confirmation pane.
+ *
+ * @param {string} divClass Class applied to main div.
+ * @param {string} propName Name of the property on this object to
which we'll assign the div.
+ * @param {string} msgs See #addText
*/
ODP.createConfirmationPane = function ( divClass, propName, msgs ) {
var dialog = this,
@@ -263,6 +267,7 @@
* @param {jQuery} $submitDiv The div for the buttons in the dialog.
* @param {string} msg The string to put in the button.
* @param {boolean} enabled Whether to turn the viewer on or off when
this button is pressed.
+ * @return {jQuery} Submit button
*/
ODP.makeSubmitButton = function ( $submitDiv, msg, enabled ) {
var dialog = this;
@@ -297,6 +302,7 @@
* Makes a cancel button for one of the panels.
*
* @param {jQuery} $submitDiv The div for the buttons in the dialog.
+ * @return {jQuery} Cancel button
*/
ODP.makeCancelButton = function ( $submitDiv ) {
var dialog = this;
@@ -369,6 +375,7 @@
* Adds the info link to the panel.
*
* @param {jQuery} $div The panel to which we're adding the link.
+ * @param {string} eventName
*/
ODP.addInfoLink = function ( $div, eventName ) {
$( '<a>' )
@@ -381,6 +388,8 @@
/**
* Checks the preference.
+ *
+ * @return {boolean} MV is enabled
*/
ODP.isEnabled = function () {
return this.config.isMediaViewerEnabledOnClick();
diff --git a/tests/qunit/mmv/mmv.bootstrap.test.js
b/tests/qunit/mmv/mmv.bootstrap.test.js
index 60317a7..d8f64da 100644
--- a/tests/qunit/mmv/mmv.bootstrap.test.js
+++ b/tests/qunit/mmv/mmv.bootstrap.test.js
@@ -59,7 +59,9 @@
// MediaViewer should work without it, and so should the tests.
bootstrap.ensureEventHandlersAreSetUp = $.noop;
- bootstrap.getViewer = function () { return viewer ? viewer : {
initWithThumbs: $.noop, hash: $.noop }; };
+ bootstrap.getViewer = function () {
+ return viewer || { initWithThumbs: $.noop, hash: $.noop
};
+ };
return bootstrap;
}
@@ -211,7 +213,7 @@
} );
QUnit.test( 'Skip images with invalid extensions', 0, function ( assert
) {
- var div, link, bootstrap,
+ var div, link,
viewer = { initWithThumbs: $.noop };
// Create gallery with image that has invalid name extension
@@ -219,7 +221,7 @@
link = div.find( 'a.image' );
// Create a new bootstrap object to trigger the DOM scan, etc.
- bootstrap = createBootstrap( viewer );
+ createBootstrap( viewer );
viewer.loadImageByTitle = function () {
assert.ok( false, 'Image should not be loaded' );
diff --git a/tests/qunit/mmv/mmv.testhelpers.js
b/tests/qunit/mmv/mmv.testhelpers.js
index 0e99f57..be38af4 100644
--- a/tests/qunit/mmv/mmv.testhelpers.js
+++ b/tests/qunit/mmv/mmv.testhelpers.js
@@ -17,7 +17,7 @@
* Returns the exception thrown by callback, or undefined if no
exception was thrown.
*
* @param {Function} callback
- * @return {*}
+ * @return {Error}
*/
MTH.getException = function ( callback ) {
var ex;
@@ -33,6 +33,7 @@
* Returns a fake local storage which is not saved between reloads.
*
* @param {Object} [initialData]
+ * @return {Object} Local storage-like object
*/
MTH.getFakeLocalStorage = function ( initialData ) {
var bag = new mw.Map();
@@ -62,4 +63,4 @@
};
mw.mmv.testHelpers = MTH;
-} )( mediaWiki, jQuery );
+}( mediaWiki, jQuery ) );
diff --git a/tests/qunit/mmv/routing/mmv.routing.Router.test.js
b/tests/qunit/mmv/routing/mmv.routing.Router.test.js
index 026c535..92c2b4b 100644
--- a/tests/qunit/mmv/routing/mmv.routing.Router.test.js
+++ b/tests/qunit/mmv/routing/mmv.routing.Router.test.js
@@ -179,10 +179,12 @@
router = new mw.mmv.routing.Router();
// mw.Title does not accept % in page names
- this.sandbox.stub( mw, 'Title', function ( name ) { return {
- name: name,
- getMain: function () { return name.replace( /^File:/,
'' ); }
- }; } );
+ this.sandbox.stub( mw, 'Title', function ( name ) {
+ return {
+ name: name,
+ getMain: function () { return name.replace(
/^File:/, '' ); }
+ };
+ } );
title = new mw.Title( 'File:%40.png' );
hash = router.createHash( new mw.mmv.routing.ThumbnailRoute(
title ) );
diff --git a/tests/qunit/mmv/ui/mmv.ui.metadataPanel.test.js
b/tests/qunit/mmv/ui/mmv.ui.metadataPanel.test.js
index 076df8f..cebc223 100644
--- a/tests/qunit/mmv/ui/mmv.ui.metadataPanel.test.js
+++ b/tests/qunit/mmv/ui/mmv.ui.metadataPanel.test.js
@@ -115,7 +115,7 @@
},
oldMoment = window.moment;
- /*window.moment = function ( date ) {
+ /* window.moment = function ( date ) {
// This has no effect for now, since writing this test
revealed that our moment.js
// doesn't have any language configuration
return oldMoment( date ).lang( 'fr' );
@@ -187,13 +187,13 @@
} );
QUnit.test( 'About links', 3, function ( assert ) {
- var panel,
- $qf = $( '#qunit-fixture' ),
+ var $qf = $( '#qunit-fixture' ),
oldWgMediaViewerIsInBeta = mw.config.get(
'wgMediaViewerIsInBeta' );
this.sandbox.stub( mw.user, 'isAnon' );
mw.config.set( 'wgMediaViewerIsInBeta', false );
- panel = new mw.mmv.ui.MetadataPanel( $qf.empty(), $( '<div>'
).appendTo( $qf ), window.localStorage, new mw.mmv.Config( {}, mw.config,
mw.user, new mw.Api(), window.localStorage ) );
+ // eslint-disable-next-line no-new
+ new mw.mmv.ui.MetadataPanel( $qf.empty(), $( '<div>'
).appendTo( $qf ), window.localStorage, new mw.mmv.Config( {}, mw.config,
mw.user, new mw.Api(), window.localStorage ) );
assert.strictEqual( $qf.find( '.mw-mmv-about-link' ).length, 1,
'About link is created.' );
assert.strictEqual( $qf.find( '.mw-mmv-discuss-link' ).length,
1, 'Discuss link is created.' );
diff --git a/tests/qunit/mmv/ui/mmv.ui.metadataPanelScroller.test.js
b/tests/qunit/mmv/ui/mmv.ui.metadataPanelScroller.test.js
index d89dbbd..9eee3b9 100644
--- a/tests/qunit/mmv/ui/mmv.ui.metadataPanelScroller.test.js
+++ b/tests/qunit/mmv/ui/mmv.ui.metadataPanelScroller.test.js
@@ -83,11 +83,13 @@
localStorage = { getItem: $.noop, setItem:
this.sandbox.stub().throwsException( 'I am full' ) },
scroller = new mw.mmv.ui.MetadataPanelScroller( $qf, $(
'<div>' ).appendTo( $qf ), localStorage );
- this.sandbox.stub( $, 'scrollTo', function () { return {
- scrollTop: function () { return 10; },
- on: $.noop,
- off: $.noop
- }; } );
+ this.sandbox.stub( $, 'scrollTo', function () {
+ return {
+ scrollTop: function () { return 10; },
+ on: $.noop,
+ off: $.noop
+ };
+ } );
scroller.attach();
diff --git a/tests/qunit/mmv/ui/mmv.ui.reuse.dialog.test.js
b/tests/qunit/mmv/ui/mmv.ui.reuse.dialog.test.js
index 4182e3b..5c72c5c 100644
--- a/tests/qunit/mmv/ui/mmv.ui.reuse.dialog.test.js
+++ b/tests/qunit/mmv/ui/mmv.ui.reuse.dialog.test.js
@@ -179,17 +179,17 @@
QUnit.test( 'set()/empty() sanity check:', 1, function ( assert ) {
var reuseDialog = makeReuseDialog( this.sandbox ),
- title = mw.Title.newFromText( 'File:Foobar.jpg' ),
- src =
'https://upload.wikimedia.org/wikipedia/commons/3/3a/Foobar.jpg',
- url = 'https://commons.wikimedia.org/wiki/File:Foobar.jpg',
- image = { // fake mw.mmv.model.Image
- title: title,
- url: src,
- descriptionUrl: url,
- width: 100,
- height: 80
- },
- embedFileInfo = new mw.mmv.model.EmbedFileInfo( title, src, url
);
+ title = mw.Title.newFromText( 'File:Foobar.jpg' ),
+ src =
'https://upload.wikimedia.org/wikipedia/commons/3/3a/Foobar.jpg',
+ url =
'https://commons.wikimedia.org/wiki/File:Foobar.jpg',
+ image = { // fake mw.mmv.model.Image
+ title: title,
+ url: src,
+ descriptionUrl: url,
+ width: 100,
+ height: 80
+ },
+ embedFileInfo = new mw.mmv.model.EmbedFileInfo( title,
src, url );
reuseDialog.set( image, embedFileInfo );
reuseDialog.empty();
@@ -199,17 +199,17 @@
QUnit.test( 'openDialog()/closeDialog():', 3, function ( assert ) {
var reuseDialog = makeReuseDialog( this.sandbox ),
- title = mw.Title.newFromText( 'File:Foobar.jpg' ),
- src =
'https://upload.wikimedia.org/wikipedia/commons/3/3a/Foobar.jpg',
- url = 'https://commons.wikimedia.org/wiki/File:Foobar.jpg',
- image = { // fake mw.mmv.model.Image
- title: title,
- url: src,
- descriptionUrl: url,
- width: 100,
- height: 80
- },
- repoInfo = new mw.mmv.model.Repo( 'Wikipedia',
'//wikipedia.org/favicon.ico', true );
+ title = mw.Title.newFromText( 'File:Foobar.jpg' ),
+ src =
'https://upload.wikimedia.org/wikipedia/commons/3/3a/Foobar.jpg',
+ url =
'https://commons.wikimedia.org/wiki/File:Foobar.jpg',
+ image = { // fake mw.mmv.model.Image
+ title: title,
+ url: src,
+ descriptionUrl: url,
+ width: 100,
+ height: 80
+ },
+ repoInfo = new mw.mmv.model.Repo( 'Wikipedia',
'//wikipedia.org/favicon.ico', true );
reuseDialog.initTabs();
diff --git a/tests/qunit/mmv/ui/mmv.ui.reuse.embed.test.js
b/tests/qunit/mmv/ui/mmv.ui.reuse.embed.test.js
index 3b36b0f..4bfbb16 100644
--- a/tests/qunit/mmv/ui/mmv.ui.reuse.embed.test.js
+++ b/tests/qunit/mmv/ui/mmv.ui.reuse.embed.test.js
@@ -40,8 +40,8 @@
QUnit.test( 'changeSize(): Skip if no item selected.', 0, function (
assert ) {
var embed = new mw.mmv.ui.reuse.Embed( $qf ),
- width = 10,
- height = 20;
+ width = 10,
+ height = 20;
// deselect items
embed.embedSwitch.selectItem();
@@ -58,8 +58,8 @@
QUnit.test( 'changeSize(): HTML size menu item selected.', 4, function
( assert ) {
var embed = new mw.mmv.ui.reuse.Embed( $qf ),
- width = 10,
- height = 20;
+ width = 10,
+ height = 20;
embed.embedSwitch.getSelectedItem = function () {
return { getData: function () { return 'html'; } };
@@ -81,8 +81,8 @@
QUnit.test( 'changeSize(): Wikitext size menu item selected.', 2,
function ( assert ) {
var embed = new mw.mmv.ui.reuse.Embed( $qf ),
- width = 10,
- height = 20;
+ width = 10,
+ height = 20;
embed.embedSwitch.getSelectedItem = function () {
return { getData: function () { return 'wikitext'; } };
@@ -102,8 +102,8 @@
QUnit.test( 'updateEmbedHtml(): Do nothing if set() not called
before.', 0, function ( assert ) {
var embed = new mw.mmv.ui.reuse.Embed( $qf ),
- width = 10,
- height = 20;
+ width = 10,
+ height = 20;
embed.formatter.getThumbnailHtml = function () {
assert.ok( false, 'formatter.getThumbnailHtml() should
not have been called.' );
@@ -149,7 +149,7 @@
QUnit.test( 'updateEmbedWikitext(): Do nothing if set() not called
before.', 0, function ( assert ) {
var embed = new mw.mmv.ui.reuse.Embed( $qf ),
- width = 10;
+ width = 10;
embed.formatter.getThumbnailWikitext = function () {
assert.ok( false, 'formatter.getThumbnailWikitext()
should not have been called.' );
@@ -176,35 +176,35 @@
QUnit.test( 'getPossibleImageSizesForWikitext()', 3, function ( assert
) {
var embed = new mw.mmv.ui.reuse.Embed( $qf ),
- exampleSizes = [
+ exampleSizes = [
// Big wide image
- {
- width: 2048, height: 1536,
- expected: {
- small: { width: 300, height: 225 },
- medium: { width: 400, height: 300 },
- large: { width: 500, height: 375 },
- 'default': { width: null, height: null }
- }
- },
+ {
+ width: 2048, height: 1536,
+ expected: {
+ small: { width: 300, height:
225 },
+ medium: { width: 400, height:
300 },
+ large: { width: 500, height:
375 },
+ 'default': { width: null,
height: null }
+ }
+ },
// Big tall image
- {
- width: 201, height: 1536,
- expected: {
- 'default': { width: null, height: null }
- }
- },
+ {
+ width: 201, height: 1536,
+ expected: {
+ 'default': { width: null,
height: null }
+ }
+ },
// Very small image
- {
- width: 15, height: 20,
- expected: {
- 'default': { width: null, height: null }
+ {
+ width: 15, height: 20,
+ expected: {
+ 'default': { width: null,
height: null }
+ }
}
- }
- ],
- i, cursize, opts;
+ ],
+ i, cursize, opts;
for ( i = 0; i < exampleSizes.length; i++ ) {
cursize = exampleSizes[ i ];
opts = embed.getPossibleImageSizesForWikitext(
cursize.width, cursize.height );
@@ -214,12 +214,12 @@
QUnit.test( 'set():', 8, function ( assert ) {
var embed = new mw.mmv.ui.reuse.Embed( $qf ),
- title = mw.Title.newFromText( 'File:Foobar.jpg' ),
- src =
'https://upload.wikimedia.org/wikipedia/commons/3/3a/Foobar.jpg',
- url = 'https://commons.wikimedia.org/wiki/File:Foobar.jpg',
- embedFileInfo = new mw.mmv.model.EmbedFileInfo( title, src, url
),
- width = 15,
- height = 20;
+ title = mw.Title.newFromText( 'File:Foobar.jpg' ),
+ src =
'https://upload.wikimedia.org/wikipedia/commons/3/3a/Foobar.jpg',
+ url =
'https://commons.wikimedia.org/wiki/File:Foobar.jpg',
+ embedFileInfo = new mw.mmv.model.EmbedFileInfo( title,
src, url ),
+ width = 15,
+ height = 20;
QUnit.stop();
@@ -250,8 +250,8 @@
QUnit.test( 'empty():', 6, function ( assert ) {
var embed = new mw.mmv.ui.reuse.Embed( $qf ),
- width = 15,
- height = 20;
+ width = 15,
+ height = 20;
embed.formatter = {
getThumbnailWikitextFromEmbedFileInfo: function () {
return 'wikitext'; },
@@ -275,12 +275,12 @@
QUnit.test( 'attach()/unattach():', 5, function ( assert ) {
var embed = new mw.mmv.ui.reuse.Embed( $qf ),
- title = mw.Title.newFromText( 'File:Foobar.jpg' ),
- src =
'https://upload.wikimedia.org/wikipedia/commons/3/3a/Foobar.jpg',
- url = 'https://commons.wikimedia.org/wiki/File:Foobar.jpg',
- embedFileInfo = new mw.mmv.model.EmbedFileInfo( title, src, url
),
- width = 15,
- height = 20;
+ title = mw.Title.newFromText( 'File:Foobar.jpg' ),
+ src =
'https://upload.wikimedia.org/wikipedia/commons/3/3a/Foobar.jpg',
+ url =
'https://commons.wikimedia.org/wiki/File:Foobar.jpg',
+ embedFileInfo = new mw.mmv.model.EmbedFileInfo( title,
src, url ),
+ width = 15,
+ height = 20;
embed.set( { width: width, height: height }, embedFileInfo );
diff --git a/tests/qunit/mmv/ui/mmv.ui.reuse.utils.test.js
b/tests/qunit/mmv/ui/mmv.ui.reuse.utils.test.js
index b07b7de..ec8fcfe 100644
--- a/tests/qunit/mmv/ui/mmv.ui.reuse.utils.test.js
+++ b/tests/qunit/mmv/ui/mmv.ui.reuse.utils.test.js
@@ -26,15 +26,15 @@
QUnit.test( 'createPulldownMenu():', 14, function ( assert ) {
var utils = new mw.mmv.ui.Utils(),
- menuItems = [ 'original', 'small', 'medium', 'large' ],
- def = 'large',
- menu = utils.createPulldownMenu(
+ menuItems = [ 'original', 'small', 'medium', 'large' ],
+ def = 'large',
+ menu = utils.createPulldownMenu(
menuItems,
[ 'mw-mmv-download-size' ],
def
),
- options = menu.getMenu().getItems(),
- i, data;
+ options = menu.getMenu().getItems(),
+ i, data;
assert.strictEqual( options.length, 4, 'Menu has correct number
of items.' );
@@ -51,16 +51,16 @@
QUnit.test( 'updateMenuOptions():', 9, function ( assert ) {
var utils = new mw.mmv.ui.Utils(),
- menu = utils.createPulldownMenu(
+ menu = utils.createPulldownMenu(
[ 'original', 'small', 'medium', 'large' ],
[ 'mw-mmv-download-size' ],
'original'
),
- options = menu.getMenu().getItems(),
- width = 700,
- height = 500,
- sizes = utils.getPossibleImageSizesForHtml( width, height ),
- oldMessage = mw.message;
+ options = menu.getMenu().getItems(),
+ width = 700,
+ height = 500,
+ sizes = utils.getPossibleImageSizesForHtml( width,
height ),
+ oldMessage = mw.message;
mw.message = function ( messageKey ) {
assert.ok( messageKey.match(
/^multimediaviewer-(small|medium|original|embed-dimensions)/ ), 'messageKey
passed correctly.' );
@@ -75,38 +75,38 @@
QUnit.test( 'getPossibleImageSizesForHtml()', 3, function ( assert ) {
var utils = new mw.mmv.ui.Utils(),
- exampleSizes = [
+ exampleSizes = [
// Big wide image
- {
- width: 2048, height: 1536,
- expected: {
- small: { width: 193, height: 145 },
- medium: { width: 640, height: 480 },
- large: { width: 1200, height: 900 },
- original: { width: 2048, height: 1536 }
- }
- },
+ {
+ width: 2048, height: 1536,
+ expected: {
+ small: { width: 193, height:
145 },
+ medium: { width: 640, height:
480 },
+ large: { width: 1200, height:
900 },
+ original: { width: 2048,
height: 1536 }
+ }
+ },
// Big tall image
- {
- width: 201, height: 1536,
- expected: {
- small: { width: 19, height: 145 },
- medium: { width: 63, height: 480 },
- large: { width: 118, height: 900 },
- original: { width: 201, height: 1536 }
- }
- },
+ {
+ width: 201, height: 1536,
+ expected: {
+ small: { width: 19, height: 145
},
+ medium: { width: 63, height:
480 },
+ large: { width: 118, height:
900 },
+ original: { width: 201, height:
1536 }
+ }
+ },
// Very small image
- {
- width: 15, height: 20,
- expected: {
- original: { width: 15, height: 20 }
+ {
+ width: 15, height: 20,
+ expected: {
+ original: { width: 15, height:
20 }
+ }
}
- }
- ],
- i, cursize, opts;
+ ],
+ i, cursize, opts;
for ( i = 0; i < exampleSizes.length; i++ ) {
cursize = exampleSizes[ i ];
opts = utils.getPossibleImageSizesForHtml(
cursize.width, cursize.height );
diff --git a/tests/qunit/mmv/ui/mmv.ui.stripeButtons.test.js
b/tests/qunit/mmv/ui/mmv.ui.stripeButtons.test.js
index c5334c3..3bd3950 100644
--- a/tests/qunit/mmv/ui/mmv.ui.stripeButtons.test.js
+++ b/tests/qunit/mmv/ui/mmv.ui.stripeButtons.test.js
@@ -25,7 +25,7 @@
QUnit.test( 'Sanity test, object creation and UI construction', 3,
function ( assert ) {
var buttons,
- oldMwUserIsAnon = mw.user.isAnon;
+ oldMwUserIsAnon = mw.user.isAnon;
// first pretend we are anonymous
mw.user.isAnon = function () { return true; };
@@ -45,8 +45,8 @@
QUnit.test( 'set()/empty() sanity test:', 1, function ( assert ) {
var buttons = createStripeButtons(),
- fakeImageInfo = { descriptionUrl:
'//commons.wikimedia.org/wiki/File:Foo.jpg' },
- fakeRepoInfo = { displayName: 'Wikimedia Commons', isCommons:
function () { return true; } };
+ fakeImageInfo = { descriptionUrl:
'//commons.wikimedia.org/wiki/File:Foo.jpg' },
+ fakeRepoInfo = { displayName: 'Wikimedia Commons',
isCommons: function () { return true; } };
buttons.set( fakeImageInfo, fakeRepoInfo );
buttons.empty();
--
To view, visit https://gerrit.wikimedia.org/r/327184
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I423add157245353031e36b7e44fee7ace7c753c7
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/MultimediaViewer
Gerrit-Branch: master
Gerrit-Owner: Esanders <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits