2018-07-30 14:35:54 +00:00
|
|
|
( function ( M ) {
|
2019-02-07 16:34:18 +00:00
|
|
|
var
|
|
|
|
mobile = M.require( 'mobile.startup' ),
|
2019-02-04 18:29:58 +00:00
|
|
|
pageIssues = M.require( 'skins.minerva.scripts/pageIssues' ),
|
2019-01-23 20:16:11 +00:00
|
|
|
insertBannersOrNotice = pageIssues.test.insertBannersOrNotice,
|
2019-02-07 16:34:18 +00:00
|
|
|
OverlayManager = mobile.OverlayManager,
|
2019-07-11 00:56:04 +00:00
|
|
|
PageHTMLParser = mobile.PageHTMLParser,
|
2019-03-18 22:04:54 +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 ) {
|
2018-07-30 14:35:54 +00:00
|
|
|
assert.strictEqual( /⧼skin-minerva-issue-learn-more⧽/.test( processedAmbox.html() ), true );
|
|
|
|
} );
|
|
|
|
|
2019-01-23 20:16:11 +00:00
|
|
|
QUnit.test( 'insertBannersOrNotice() should add an icon', function ( assert ) {
|
2018-07-30 14:35:54 +00:00
|
|
|
assert.strictEqual( /mw-ui-icon/.test( processedAmbox.html() ), true );
|
|
|
|
} );
|
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
|
|
|
} );
|
|
|
|
}( mw.mobileFrontend ) );
|