mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/MultimediaViewer
synced 2024-11-23 15:56:47 +00:00
Fix mmv.ui.metadataPanel.test.js
Regression of I3a4024ccf90e50558152d4ee012e492f49e14a0e: unless mw.messages.exists the license shortName CC-BY-2.0 is returned, breaking "License is correctly set" in setImageInfo() in mmv.ui.metadataPanel.test. Change-Id: I35f67fa3d160d771970b5695fb93f5de7ea2d41d
This commit is contained in:
parent
683ca2a2dd
commit
3d350a29ab
|
@ -1,7 +1,16 @@
|
|||
const { Config } = require( 'mmv.bootstrap' );
|
||||
const { MetadataPanel, License } = require( 'mmv' );
|
||||
|
||||
QUnit.module( 'mmv.ui.metadataPanel', QUnit.newMwEnvironment() );
|
||||
const mwMessagesExists = mw.messages.exists;
|
||||
QUnit.module( 'mmv.ui.metadataPanel', QUnit.newMwEnvironment( {
|
||||
beforeEach: () => {
|
||||
// mock mw.messages.exists for License.getShortLink (multimediaviewer-license-cc-by-2.0)
|
||||
mw.messages.exists = () => true;
|
||||
},
|
||||
afterEach: () => {
|
||||
mw.messages.exists = mwMessagesExists;
|
||||
}
|
||||
} ) );
|
||||
|
||||
QUnit.test( '.empty()', ( assert ) => {
|
||||
const $qf = $( '#qunit-fixture' );
|
||||
|
@ -46,9 +55,7 @@ QUnit.test( '.setLocationData()', ( assert ) => {
|
|||
const imageData = {
|
||||
latitude: latitude,
|
||||
longitude: longitude,
|
||||
hasCoords: function () {
|
||||
return true;
|
||||
},
|
||||
hasCoords: () => true,
|
||||
title: mw.Title.newFromText( 'File:Foobar.jpg' )
|
||||
};
|
||||
|
||||
|
@ -116,9 +123,7 @@ QUnit.test( '.setImageInfo()', function ( assert ) {
|
|||
title: image.filePageTitle,
|
||||
url: 'https://upload.wikimedia.org/wikipedia/commons/3/3a/Foobar.jpg',
|
||||
descriptionUrl: 'https://commons.wikimedia.org/wiki/File:Foobar.jpg',
|
||||
hasCoords: function () {
|
||||
return false;
|
||||
}
|
||||
hasCoords: () => false
|
||||
};
|
||||
const clock = this.sandbox.useFakeTimers();
|
||||
|
||||
|
|
Loading…
Reference in a new issue