mediawiki-skins-Vector/tests/jest/App.test.js
Ed Sanders 7e7486c4a5 build: Update eslint-config-wikimedia to 0.28.0 and autofix
Change-Id: I350941a711d2304fc968b3ba1f1e0afa5878578e
2024-06-06 16:22:05 +01:00

39 lines
886 B
JavaScript

const VueTestUtils = require( '@vue/test-utils' );
const App = require( '../../resources/skins.vector.search/App.vue' );
const defaultProps = {
id: 'searchform',
searchAccessKey: 'f',
searchTitle: 'search',
showThumbnail: true,
showDescription: true,
highlightQuery: true,
searchPlaceholder: 'Search MediaWiki',
searchQuery: ''
};
const mount = ( /** @type {Object} */ customProps ) => VueTestUtils.shallowMount( App, {
props: Object.assign( {}, defaultProps, customProps ),
global: {
mocks: {
$i18n: ( /** @type {string} */ str ) => ( {
text: () => str
} )
},
directives: {
'i18n-html': ( el, binding ) => {
el.innerHTML = `${ binding.arg } (${ binding.value })`;
}
}
}
} );
describe( 'App', () => {
it( 'renders a typeahead search component', () => {
const wrapper = mount();
expect(
wrapper.element
).toMatchSnapshot();
} );
} );