2023-11-03 19:26:16 +00:00
|
|
|
( function ( M ) {
|
|
|
|
var
|
|
|
|
mobile = M.require( 'mobile.startup' ),
|
2019-07-02 21:10:10 +00:00
|
|
|
pageIssues = require( '../../../../resources/skins.minerva.scripts/page-issues/index.js' ),
|
2019-01-23 20:16:11 +00:00
|
|
|
insertBannersOrNotice = pageIssues.test.insertBannersOrNotice,
|
2023-11-03 19:26:16 +00:00
|
|
|
OverlayManager = mobile.OverlayManager,
|
2019-07-11 00:56:04 +00:00
|
|
|
PageHTMLParser = mobile.PageHTMLParser,
|
2023-11-03 19:26:16 +00:00
|
|
|
overlayManager = OverlayManager.getSingleton(),
|
2018-07-30 14:35:54 +00:00
|
|
|
$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,
|
2018-09-12 21:04:18 +00:00
|
|
|
SECTION = '0',
|
2019-01-23 20:16:11 +00:00
|
|
|
processedAmbox = insertBannersOrNotice(
|
2019-07-11 00:56:04 +00:00
|
|
|
new PageHTMLParser( $mockContainer ),
|
2018-09-12 21:04:18 +00:00
|
|
|
labelText, SECTION, inline, overlayManager
|
2019-02-04 16:22:09 +00:00
|
|
|
).ambox;
|
2018-07-30 14:35:54 +00:00
|
|
|
|
2019-02-21 18:41:26 +00:00
|
|
|
QUnit.module( 'Minerva pageIssues' );
|
2018-07-30 14:35:54 +00:00
|
|
|
|
2019-01-23 20:16:11 +00:00
|
|
|
QUnit.test( 'insertBannersOrNotice() should add a "learn more" message', function ( assert ) {
|
2022-05-15 00:41:24 +00:00
|
|
|
assert.true( /⧼skin-minerva-issue-learn-more⧽/.test( processedAmbox.html() ) );
|
2018-07-30 14:35:54 +00:00
|
|
|
} );
|
|
|
|
|
2019-01-23 20:16:11 +00:00
|
|
|
QUnit.test( 'insertBannersOrNotice() should add an icon', function ( assert ) {
|
2023-11-03 19:26:16 +00:00
|
|
|
// FIXME: Remove mw-ui-icon when T346184 and/or T346162 has been resolved.
|
|
|
|
assert.true( /(mw-ui-icon|mf-icon)/.test( processedAmbox.html() ) );
|
2018-07-30 14:35:54 +00:00
|
|
|
} );
|
2019-01-23 20:16:11 +00:00
|
|
|
QUnit.test( 'clicking on the product of insertBannersOrNotice() should trigger a URL change', function ( assert ) {
|
2018-07-30 14:35:54 +00:00
|
|
|
processedAmbox.click();
|
2018-09-12 21:04:18 +00:00
|
|
|
assert.strictEqual( window.location.hash, '#/issues/' + SECTION );
|
2018-07-30 14:35:54 +00:00
|
|
|
} );
|
2023-11-03 19:26:16 +00:00
|
|
|
}( mw.mobileFrontend ) );
|