mirror of
https://gerrit.wikimedia.org/r/mediawiki/skins/MinervaNeue
synced 2024-12-01 01:06:31 +00:00
2380e78f88
"cleanuptemplates" was the old page issues module name. The new name is "pageIssues". Update the test module name. Change-Id: Ie31e4d1548918463f6e33429ded3abc4bfb08dff
40 lines
1.4 KiB
JavaScript
40 lines
1.4 KiB
JavaScript
( function ( M ) {
|
|
var
|
|
mobile = M.require( 'mobile.startup' ),
|
|
pageIssues = M.require( 'skins.minerva.scripts/pageIssues' ),
|
|
insertBannersOrNotice = pageIssues.test.insertBannersOrNotice,
|
|
OverlayManager = mobile.OverlayManager,
|
|
Page = mobile.Page,
|
|
overlayManager = new OverlayManager( require( 'mediawiki.router' ) ),
|
|
$mockContainer = $(
|
|
'<div id=\'bodyContent\'>' +
|
|
'<table class=\'ambox ambox-content\'>' +
|
|
'<tbody class=\'mbox-text\'>' +
|
|
'<tr><td><span class=\'mbox-text-span\'> ambox text span </span></td></tr>' +
|
|
'</tbody>' +
|
|
'</table>' +
|
|
'</div>'
|
|
),
|
|
labelText = 'label text',
|
|
inline = true,
|
|
SECTION = '0',
|
|
processedAmbox = insertBannersOrNotice(
|
|
new Page( { el: $mockContainer } ),
|
|
labelText, SECTION, inline, overlayManager
|
|
).ambox;
|
|
|
|
QUnit.module( 'Minerva pageIssues' );
|
|
|
|
QUnit.test( 'insertBannersOrNotice() should add a "learn more" message', function ( assert ) {
|
|
assert.strictEqual( /⧼skin-minerva-issue-learn-more⧽/.test( processedAmbox.html() ), true );
|
|
} );
|
|
|
|
QUnit.test( 'insertBannersOrNotice() should add an icon', function ( assert ) {
|
|
assert.strictEqual( /mw-ui-icon/.test( processedAmbox.html() ), true );
|
|
} );
|
|
QUnit.test( 'clicking on the product of insertBannersOrNotice() should trigger a URL change', function ( assert ) {
|
|
processedAmbox.click();
|
|
assert.strictEqual( window.location.hash, '#/issues/' + SECTION );
|
|
} );
|
|
}( mw.mobileFrontend ) );
|