2023-11-07 16:29:17 +00:00
|
|
|
( function () {
|
|
|
|
const
|
|
|
|
mobile = 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,
|
2019-07-11 00:56:04 +00:00
|
|
|
PageHTMLParser = mobile.PageHTMLParser,
|
2023-11-07 16:29:17 +00:00
|
|
|
overlayManager = mobile.getOverlayManager(),
|
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
|
|
|
|
2024-06-03 12:06:43 +00:00
|
|
|
QUnit.test( 'insertBannersOrNotice() should add a "learn more" message', ( 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
|
|
|
} );
|
|
|
|
|
2024-06-03 12:06:43 +00:00
|
|
|
QUnit.test( 'insertBannersOrNotice() should add an icon', ( assert ) => {
|
2023-11-07 16:29:17 +00:00
|
|
|
assert.true( /(minerva-icon)/.test( processedAmbox.html() ) );
|
2018-07-30 14:35:54 +00:00
|
|
|
} );
|
2024-06-03 12:06:43 +00:00
|
|
|
QUnit.test( 'clicking on the product of insertBannersOrNotice() should trigger a URL change', ( 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-07 16:29:17 +00:00
|
|
|
}() );
|