const menuTabs = require( '../../../resources/skins.vector.js/menuTabs.js' ); describe( 'menuTabs', () => { beforeEach( () => { /** @type {Function} */ let callback; jest.spyOn( mw, 'hook' ).mockImplementation( () => { return { add: function ( fn ) { callback = fn; return this; }, fire: ( data ) => { if ( callback ) { callback( data ); } } }; } ); } ); afterEach( () => { jest.restoreAllMocks(); } ); test( 'adds vector-tab-noicon class to li element when part of tabs', () => { document.body.innerHTML = `
`; const menuItem = document.getElementById( 'test-id' ); menuTabs(); mw.hook( 'util' ).fire( menuItem, { id: 'test-id' } ); expect( document.body.innerHTML ).toMatchSnapshot(); } ); test( 'does not add vector-tab-noicon class to li element when not part of tabs', () => { document.body.innerHTML = ` `; const menuItem = document.getElementById( 'test-id' ); menuTabs(); mw.hook( 'util' ).fire( menuItem, { id: 'test-id' } ); expect( document.body.innerHTML ).toMatchSnapshot(); } ); } );