mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/MultimediaViewer
synced 2024-11-16 20:35:09 +00:00
Merge "Fix two failing QUnit tests"
This commit is contained in:
commit
9dab34cc69
|
@ -284,7 +284,7 @@
|
|||
$link.trigger( { type: 'click', which: 1 } );
|
||||
} );
|
||||
|
||||
QUnit.test( 'Validate new LightboxImage object has sane constructor parameters', 8, function ( assert ) {
|
||||
QUnit.test( 'Validate new LightboxImage object has sane constructor parameters', 9, function ( assert ) {
|
||||
var bootstrap,
|
||||
$div,
|
||||
$link,
|
||||
|
@ -299,11 +299,14 @@
|
|||
viewer.loadImage = $.noop;
|
||||
|
||||
viewer.createNewImage = function ( fileLink, filePageLink, fileTitle, index, thumb, caption, alt ) {
|
||||
var html = thumb.outerHTML;
|
||||
|
||||
assert.ok( fileLink.match( imgRegex ), 'Thumbnail URL used in creating new image object' );
|
||||
assert.strictEqual( filePageLink, '', 'File page link is sane when creating new image object' );
|
||||
assert.strictEqual( fileTitle.title, fname, 'Filename is correct when passed into new image constructor' );
|
||||
assert.strictEqual( index, 0, 'The only image we created in the gallery is set at index 0 in the images array' );
|
||||
assert.strictEqual( thumb.outerHTML, '<img src="' + imgSrc + '" alt="meow">', 'The image element passed in is the thumbnail we want.' );
|
||||
assert.ok( html.indexOf( ' src="' + imgSrc + '"' ) > 0, 'The image element passed in contains the src=... we want.' );
|
||||
assert.ok( html.indexOf( ' alt="meow"' ) > 0, 'The image element passed in contains the alt=... we want.' );
|
||||
assert.strictEqual( caption, 'Blah blah', 'The caption passed in is correct' );
|
||||
assert.strictEqual( alt, 'meow', 'The alt text passed in is correct' );
|
||||
};
|
||||
|
|
|
@ -98,7 +98,8 @@
|
|||
} );
|
||||
|
||||
QUnit.test( 'Setting image information works as expected', 18, function ( assert ) {
|
||||
var gender,
|
||||
var creditPopupText,
|
||||
gender,
|
||||
$qf = $( '#qunit-fixture' ),
|
||||
panel = new mw.mmv.ui.MetadataPanel( $qf, $( '<div>' ).appendTo( $qf ), window.localStorage, new mw.mmv.Config( {}, mw.config, mw.user, new mw.Api(), window.localStorage ) ),
|
||||
title = 'Foo bar',
|
||||
|
@ -145,13 +146,15 @@
|
|||
imageData.lastUploader = 'Ursula';
|
||||
|
||||
panel.setImageInfo( image, imageData, repoData, gender );
|
||||
creditPopupText = panel.creditField.$element.attr( 'original-title' );
|
||||
|
||||
assert.strictEqual( panel.$title.text(), title, 'Title is correctly set' );
|
||||
assert.ok( !panel.$credit.hasClass( 'empty' ), 'Credit is not empty' );
|
||||
assert.ok( !panel.$datetimeLi.hasClass( 'empty' ), 'Date/Time is not empty' );
|
||||
assert.strictEqual( panel.creditField.$element.find( '.mw-mmv-author' ).text(), imageData.author, 'Author text is correctly set' );
|
||||
assert.strictEqual( panel.creditField.$element.find( '.mw-mmv-source' ).html(), '<b>Lost</b><a href="foo">Bar</a>', 'Source text is correctly set' );
|
||||
assert.strictEqual( panel.creditField.$element.attr( 'original-title' ), 'Author and source information', 'Source tooltip is correctly set' );
|
||||
// Either multimediaviewer-credit-popup-text or multimediaviewer-credit-popup-text-more.
|
||||
assert.ok( creditPopupText === 'Author and source information' || creditPopupText === 'View full author and source', 'Source tooltip is correctly set' );
|
||||
assert.ok( panel.$datetime.text().indexOf( 'August 26, 2013' ) > 0, 'Correct date is displayed' );
|
||||
assert.strictEqual( panel.$license.text(), 'CC BY 2.0', 'License is correctly set' );
|
||||
assert.ok( panel.$license.prop( 'target' ), 'License information opens in new window' );
|
||||
|
|
Loading…
Reference in a new issue