mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/MultimediaViewer
synced 2024-11-24 08:13:38 +00:00
Fix tests
Tests are now run with qqx language. Bug: T252543 Change-Id: Ibe87b3ee64d5607bee12faf453cbb9fec64c5d2b
This commit is contained in:
parent
16e99fdc31
commit
6a85e6c111
|
@ -229,7 +229,7 @@
|
|||
}
|
||||
} );
|
||||
|
||||
assert.strictEqual( txt, 'By Author - Source, link', 'Sanity check' );
|
||||
assert.strictEqual( txt, '(multimediaviewer-text-embed-credit-text-b: (multimediaviewer-credit: Author, Source), link)', 'Sanity check' );
|
||||
|
||||
txt = formatter.getCreditText( {
|
||||
repoInfo: {
|
||||
|
@ -251,7 +251,7 @@
|
|||
}
|
||||
} );
|
||||
|
||||
assert.strictEqual( txt, 'By Author - Source, WTFPL v2, link', 'License message works' );
|
||||
assert.strictEqual( txt, '(multimediaviewer-text-embed-credit-text-bl: (multimediaviewer-credit: Author, Source), WTFPL v2, link)', 'License message works' );
|
||||
} );
|
||||
|
||||
QUnit.test( 'getCreditHtml():', function ( assert ) {
|
||||
|
@ -273,7 +273,11 @@
|
|||
}
|
||||
} );
|
||||
|
||||
assert.strictEqual( html, 'By Author - Source, <a href="some link">Link</a>', 'Sanity check' );
|
||||
assert.strictEqual(
|
||||
html,
|
||||
'(multimediaviewer-html-embed-credit-text-b: (multimediaviewer-credit: Author, Source), <a href="some link">(multimediaviewer-html-embed-credit-link-text)</a>)',
|
||||
'Sanity check'
|
||||
);
|
||||
|
||||
html = formatter.getCreditHtml( {
|
||||
repoInfo: {
|
||||
|
@ -296,6 +300,10 @@
|
|||
}
|
||||
} );
|
||||
|
||||
assert.strictEqual( html, 'By Author - Source, <a href="http://www.wtfpl.net/">WTFPL v2</a>, <a href="some link">Link</a>', 'Sanity check' );
|
||||
assert.strictEqual(
|
||||
html,
|
||||
'(multimediaviewer-html-embed-credit-text-bl: (multimediaviewer-credit: Author, Source), <a href="http://www.wtfpl.net/">WTFPL v2</a>, <a href="some link">(multimediaviewer-html-embed-credit-link-text)</a>)',
|
||||
'Sanity check'
|
||||
);
|
||||
} );
|
||||
}() );
|
||||
|
|
|
@ -48,13 +48,13 @@
|
|||
|
||||
assert.strictEqual(
|
||||
panel.$location.text(),
|
||||
'Location: 12° 20′ 44.44″ N, 98° 45′ 55.56″ E',
|
||||
'(multimediaviewer-geolocation: (multimediaviewer-geoloc-coords: (multimediaviewer-geoloc-coord: 12, 20, 44.44, (multimediaviewer-geoloc-north)), (multimediaviewer-geoloc-coord: 98, 45, 55.56, (multimediaviewer-geoloc-east))))',
|
||||
'Location text is set as expected - if this fails it may be due to i18n issues.'
|
||||
);
|
||||
|
||||
assert.strictEqual(
|
||||
panel.$location.prop( 'href' ),
|
||||
'http://tools.wmflabs.org/geohack/geohack.php?pagename=File:' + fileName + '¶ms=' + latitude + '_N_' + longitude + '_E_&language=en',
|
||||
'http://tools.wmflabs.org/geohack/geohack.php?pagename=File:' + fileName + '¶ms=' + latitude + '_N_' + longitude + '_E_&language=qqx',
|
||||
'Location URL is set as expected'
|
||||
);
|
||||
|
||||
|
@ -66,13 +66,13 @@
|
|||
|
||||
assert.strictEqual(
|
||||
panel.$location.text(),
|
||||
'Location: 12° 20′ 44.44″ S, 98° 45′ 55.56″ W',
|
||||
'(multimediaviewer-geolocation: (multimediaviewer-geoloc-coords: (multimediaviewer-geoloc-coord: 12, 20, 44.44, (multimediaviewer-geoloc-south)), (multimediaviewer-geoloc-coord: 98, 45, 55.56, (multimediaviewer-geoloc-west))))',
|
||||
'Location text is set as expected - if this fails it may be due to i18n issues.'
|
||||
);
|
||||
|
||||
assert.strictEqual(
|
||||
panel.$location.prop( 'href' ),
|
||||
'http://tools.wmflabs.org/geohack/geohack.php?pagename=File:' + fileName + '¶ms=' + ( -latitude ) + '_S_' + ( -longitude ) + '_W_&language=en',
|
||||
'http://tools.wmflabs.org/geohack/geohack.php?pagename=File:' + fileName + '¶ms=' + ( -latitude ) + '_S_' + ( -longitude ) + '_W_&language=qqx',
|
||||
'Location URL is set as expected'
|
||||
);
|
||||
|
||||
|
@ -84,13 +84,13 @@
|
|||
|
||||
assert.strictEqual(
|
||||
panel.$location.text(),
|
||||
'Location: 0° 0′ 0″ N, 0° 0′ 0″ E',
|
||||
'(multimediaviewer-geolocation: (multimediaviewer-geoloc-coords: (multimediaviewer-geoloc-coord: 0, 0, 0, (multimediaviewer-geoloc-north)), (multimediaviewer-geoloc-coord: 0, 0, 0, (multimediaviewer-geoloc-east))))',
|
||||
'Location text is set as expected - if this fails it may be due to i18n issues.'
|
||||
);
|
||||
|
||||
assert.strictEqual(
|
||||
panel.$location.prop( 'href' ),
|
||||
'http://tools.wmflabs.org/geohack/geohack.php?pagename=File:' + fileName + '¶ms=' + latitude + '_N_' + longitude + '_E_&language=en',
|
||||
'http://tools.wmflabs.org/geohack/geohack.php?pagename=File:' + fileName + '¶ms=' + latitude + '_N_' + longitude + '_E_&language=qqx',
|
||||
'Location URL is set as expected'
|
||||
);
|
||||
} );
|
||||
|
@ -144,9 +144,9 @@
|
|||
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' );
|
||||
// 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( '26 August 2013' ) > 0, 'Correct date is displayed' );
|
||||
assert.strictEqual( panel.$license.text(), 'CC BY 2.0', 'License is correctly set' );
|
||||
assert.ok( creditPopupText === '(multimediaviewer-credit-popup-text)' || creditPopupText === '(multimediaviewer-credit-popup-text-more)', 'Source tooltip is correctly set' );
|
||||
assert.strictEqual( panel.$datetime.text(), '(multimediaviewer-datetime-created: August 26, 2013)', 'Correct date is displayed' );
|
||||
assert.strictEqual( panel.$license.text(), '(multimediaviewer-license-cc-by-2.0)', 'License is correctly set' );
|
||||
assert.ok( panel.$license.prop( 'target' ), 'License information opens in new window' );
|
||||
assert.strictEqual( panel.$restrictions.children().last().children().hasClass( 'mw-mmv-restriction-default' ), true, 'Default restriction is correctly displayed last' );
|
||||
|
||||
|
@ -154,7 +154,7 @@
|
|||
panel.setImageInfo( image, imageData, repoData );
|
||||
clock.tick( 10 );
|
||||
|
||||
assert.ok( panel.$datetime.text().indexOf( '25 August 2013' ) > 0, 'Correct date is displayed' );
|
||||
assert.strictEqual( panel.$datetime.text(), '(multimediaviewer-datetime-uploaded: August 25, 2013)', 'Correct date is displayed' );
|
||||
|
||||
clock.restore();
|
||||
} );
|
||||
|
|
|
@ -50,26 +50,26 @@
|
|||
$cancelButton = dialog.$disableDiv.find( 'button.mw-mmv-options-cancel-button' );
|
||||
|
||||
assert.strictEqual( $header.length, 1, 'Disable header created successfully.' );
|
||||
assert.strictEqual( $header.text(), 'Disable Media Viewer?', 'Disable header has correct text (if this fails, it may be due to i18n differences)' );
|
||||
assert.strictEqual( $header.text(), '(multimediaviewer-options-dialog-header)', 'Disable header has correct text (if this fails, it may be due to i18n differences)' );
|
||||
|
||||
assert.strictEqual( $icon.length, 1, 'Icon created successfully.' );
|
||||
assert.strictEqual( $icon.html(), ' ', 'Icon has a blank space in it.' );
|
||||
|
||||
assert.ok( $text, 'Text div created successfully.' );
|
||||
assert.strictEqual( $textHeader.length, 1, 'Text header created successfully.' );
|
||||
assert.strictEqual( $textHeader.text(), 'Skip this viewing feature for all files.', 'Text header has correct text (if this fails, it may be due to i18n differences)' );
|
||||
assert.strictEqual( $textHeader.text(), '(multimediaviewer-options-text-header)', 'Text header has correct text (if this fails, it may be due to i18n differences)' );
|
||||
|
||||
assert.strictEqual( $textBody.length, 1, 'Text body created successfully.' );
|
||||
assert.strictEqual( $textBody.text(), 'You can enable it later through the file details page.', 'Text body has correct text (if this fails, it may be due to i18n differences)' );
|
||||
assert.strictEqual( $textBody.text(), '(multimediaviewer-options-text-body)', 'Text body has correct text (if this fails, it may be due to i18n differences)' );
|
||||
|
||||
assert.strictEqual( $aboutLink.length, 1, 'About link created successfully.' );
|
||||
assert.strictEqual( $aboutLink.text(), 'Learn more', 'About link has correct text (if this fails, it may be due to i18n differences)' );
|
||||
assert.strictEqual( $aboutLink.text(), '(multimediaviewer-options-learn-more)', 'About link has correct text (if this fails, it may be due to i18n differences)' );
|
||||
|
||||
assert.strictEqual( $submitButton.length, 1, 'Disable button created successfully.' );
|
||||
assert.strictEqual( $submitButton.text(), 'Disable Media Viewer', 'Disable button has correct text (if this fails, it may be due to i18n differences)' );
|
||||
assert.strictEqual( $submitButton.text(), '(multimediaviewer-option-submit-button)', 'Disable button has correct text (if this fails, it may be due to i18n differences)' );
|
||||
|
||||
assert.strictEqual( $cancelButton.length, 1, 'Cancel button created successfully.' );
|
||||
assert.strictEqual( $cancelButton.text(), 'Cancel', 'Cancel button has correct text (if this fails, it may be due to i18n differences)' );
|
||||
assert.strictEqual( $cancelButton.text(), '(multimediaviewer-option-cancel-button)', 'Cancel button has correct text (if this fails, it may be due to i18n differences)' );
|
||||
|
||||
$submitButton.trigger( 'click' );
|
||||
|
||||
|
@ -106,23 +106,23 @@
|
|||
$cancelButton = dialog.$enableDiv.find( 'button.mw-mmv-options-cancel-button' );
|
||||
|
||||
assert.strictEqual( $header.length, 1, 'Enable header created successfully.' );
|
||||
assert.strictEqual( $header.text(), 'Enable Media Viewer?', 'Enable header has correct text (if this fails, it may be due to i18n differences)' );
|
||||
assert.strictEqual( $header.text(), '(multimediaviewer-enable-dialog-header)', 'Enable header has correct text (if this fails, it may be due to i18n differences)' );
|
||||
|
||||
assert.strictEqual( $icon.length, 1, 'Icon created successfully.' );
|
||||
assert.strictEqual( $icon.html(), ' ', 'Icon has a blank space in it.' );
|
||||
|
||||
assert.ok( $text, 'Text div created successfully.' );
|
||||
assert.strictEqual( $textHeader.length, 1, 'Text header created successfully.' );
|
||||
assert.strictEqual( $textHeader.text(), 'Enable this media viewing feature for all files by default.', 'Text header has correct text (if this fails, it may be due to i18n differences)' );
|
||||
assert.strictEqual( $textHeader.text(), '(multimediaviewer-enable-text-header)', 'Text header has correct text (if this fails, it may be due to i18n differences)' );
|
||||
|
||||
assert.strictEqual( $aboutLink.length, 1, 'About link created successfully.' );
|
||||
assert.strictEqual( $aboutLink.text(), 'Learn more', 'About link has correct text (if this fails, it may be due to i18n differences)' );
|
||||
assert.strictEqual( $aboutLink.text(), '(multimediaviewer-options-learn-more)', 'About link has correct text (if this fails, it may be due to i18n differences)' );
|
||||
|
||||
assert.strictEqual( $submitButton.length, 1, 'Enable button created successfully.' );
|
||||
assert.strictEqual( $submitButton.text(), 'Enable Media Viewer', 'Enable button has correct text (if this fails, it may be due to i18n differences)' );
|
||||
assert.strictEqual( $submitButton.text(), '(multimediaviewer-enable-submit-button)', 'Enable button has correct text (if this fails, it may be due to i18n differences)' );
|
||||
|
||||
assert.strictEqual( $cancelButton.length, 1, 'Cancel button created successfully.' );
|
||||
assert.strictEqual( $cancelButton.text(), 'Cancel', 'Cancel button has correct text (if this fails, it may be due to i18n differences)' );
|
||||
assert.strictEqual( $cancelButton.text(), '(multimediaviewer-option-cancel-button)', 'Cancel button has correct text (if this fails, it may be due to i18n differences)' );
|
||||
|
||||
$submitButton.trigger( 'click' );
|
||||
|
||||
|
|
Loading…
Reference in a new issue