const { addPortletLinkHandler } = require( '../../../resources/skins.vector.js/dropdownMenus.js' );
describe( 'addPortletLinkHandler', () => {
test( 'Adds a span with icon class to dropdown menus', () => {
//
element is the assumed HTML output of mw.util.addPortlet
document.body.innerHTML = `
`;
const mockPortletItem = document.getElementById( 'test-id' );
// @ts-ignore: mockPortletItem possibly 'null'.
addPortletLinkHandler( mockPortletItem, { id: 'test-id' } );
expect( document.body.innerHTML ).toMatchSnapshot();
} );
test( 'Does not add an icon when noicon class is present', () => {
// element is the assumed HTML output of mw.util.addPortlet
document.body.innerHTML = `
`;
const mockPortletItem = document.getElementById( 'test-id' );
// @ts-ignore: mockPortletItem possibly 'null'.
addPortletLinkHandler( mockPortletItem, { id: 'test-id' } );
expect( document.body.innerHTML ).toMatchSnapshot();
} );
test( 'JS portlet should be moved to more menu (#p-cactions) at narrow widths', () => {
// element is the assumed HTML output of mw.util.addPortlet
document.body.innerHTML = `
`;
const mockPortletItem = document.getElementById( 'test-id' );
// @ts-ignore: mockPortletItem possibly 'null'.
addPortletLinkHandler( mockPortletItem, { id: 'test-id' } );
expect( document.body.innerHTML ).toMatchSnapshot();
} );
} );