mediawiki-skins-Vector/tests/jest/App.test.js
James D. Forrester 1c93d0514b build: Upgrade eslint-config-wikimedia from 0.25.1 to 0.26.0
Bug: T345100
Change-Id: I51fdef33d517ce4f2f50930bc46dddb2f497677c
2024-01-11 14:19:57 -05:00

41 lines
913 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 ) => {
return 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();
} );
} );