mediawiki-skins-Vector/tests/jest/App.test.js

36 lines
799 B
JavaScript
Raw Normal View History

const Vue = require( 'vue' );
const VueTestUtils = require( '@vue/test-utils' );
const App = require( '../../resources/skins.vector.search/App.vue' );
// @ts-ignore
Vue.directive( 'i18n-html', () => {} );
const defaultProps = {
id: 'searchform',
searchAccessKey: 'f',
searchTitle: 'search',
searchPlaceholder: 'Search MediaWiki',
searchQuery: ''
};
const mount = ( /** @type {Object} */ customProps ) => {
// @ts-ignore
return VueTestUtils.shallowMount( App, {
propsData: Object.assign( {}, defaultProps, customProps ),
mocks: {
$i18n: ( /** @type {string} */ str ) => ( {
text: () => str
} )
}
} );
};
describe( 'App', () => {
it( 'renders a typeahead search component', () => {
const wrapper = mount();
expect(
wrapper.element
).toMatchSnapshot();
} );
} );