Skip to content

Instantly share code, notes, and snippets.

@kahirokunn
Last active February 4, 2020 08:40
Show Gist options
  • Save kahirokunn/a15c911cbad33082afb41cc861524c2d to your computer and use it in GitHub Desktop.
Save kahirokunn/a15c911cbad33082afb41cc861524c2d to your computer and use it in GitHub Desktop.
for issue
import { FunctionalComponentOptions } from 'vue'
import { shallowMount, createLocalVue } from '@vue/test-utils'
let localVue: ReturnType<typeof createLocalVue>
describe('test', () => {
beforeEach(() => {
localVue = createLocalVue()
})
it('success mount', () => {
const functionalComponent: FunctionalComponentOptions<{ tag: string }> = {
functional: true,
props: {
tag: {
type: String,
default: 'div'
}
},
render(h, { props: { tag } }) {
return h(tag)
}
}
const wrapper = shallowMount(functionalComponent, { localVue, propsData: { tag: 'p' } })
expect(wrapper.html()).toMatchSnapshot();
})
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment