mirror of
https://gerrit.wikimedia.org/r/mediawiki/skins/Vector.git
synced 2024-12-13 16:38:44 +00:00
36 lines
799 B
JavaScript
36 lines
799 B
JavaScript
|
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();
|
||
|
} );
|
||
|
} );
|