Debian Codegraph @

skins/MinervaNeue/tests/qunit/skins.minerva.scripts/page-issues/index.test.js

raw symbols SCIP
1 QUnit.module( 'Minerva pageIssues', () => {
2 const mobile = require( 'mobile.startup' );
3 const pageIssues = require( 'skins.minerva.scripts/page-issues/index.js' );
4 const insertBannersOrNotice = pageIssues.test.insertBannersOrNotice;
5 const PageHTMLParser = mobile.PageHTMLParser;
6 const overlayManager = mobile.getOverlayManager();
7 const $mockContainer = $(
8 '<div id="bodyContent">' +
9 '<table class="ambox ambox-content">' +
10 '<tbody class="mbox-text">' +
11 '<tr><td><span class="mbox-text-span"> ambox text span </span></td></tr>' +
12 '</tbody>' +
13 '</table>' +
14 '</div>'
15 );
16 const labelText = 'label text';
17 const inline = true;
18 const SECTION = '0';
19 const processedAmbox = insertBannersOrNotice(
20 new PageHTMLParser( $mockContainer ),
21 labelText, SECTION, inline, overlayManager
22 ).ambox;
23
24 QUnit.test( 'insertBannersOrNotice() should add a "learn more" message', ( assert ) => {
25 assert.true( /(skin-minerva-issue-learn-more)/.test( processedAmbox.html() ) );
26 } );
27
28 QUnit.test( 'insertBannersOrNotice() should add an icon', ( assert ) => {
29 assert.true( /(minerva-icon)/.test( processedAmbox.html() ) );
30 } );
31 QUnit.test( 'clicking on the product of insertBannersOrNotice() should trigger a URL change', ( assert ) => {
32 processedAmbox.click();
33 assert.strictEqual( window.location.hash, '#/issues/' + SECTION );
34 } );
35 } );