Skip to content
Permalink
Browse files
feat: do not stub unregistered components (#1048)
  • Loading branch information
eddyerburgh committed Dec 1, 2018
1 parent 89f4ffc commit fb7a66c2910473023ddad261db6d842301ad4049
Showing with 16 additions and 4 deletions.
  1. +4 −1 packages/create-instance/patch-render.js
  2. +12 −3 test/specs/shallow-mount.spec.js
@@ -87,8 +87,11 @@ export function patchRender (_Vue, stubs, stubAllComponents) {
if (typeof el === 'string') {
let original = resolveComponent(el, originalComponents)

if (!original) {
return originalCreateElement(el, ...args)
}

if (
original &&
original.options &&
original.options.$_vueTestUtils_original
) {
@@ -9,7 +9,7 @@ import ComponentWithoutName from '~resources/components/component-without-name.v
import ComponentAsAClassWithChild from '~resources/components/component-as-a-class-with-child.vue'
import RecursiveComponent from '~resources/components/recursive-component.vue'
import { vueVersion } from '~resources/utils'
import { describeRunIf, itDoNotRunIf, itSkipIf } from 'conditional-specs'
import { describeRunIf, itDoNotRunIf } from 'conditional-specs'

describeRunIf(process.env.TEST_ENV !== 'node', 'shallowMount', () => {
beforeEach(() => {
@@ -379,8 +379,17 @@ describeRunIf(process.env.TEST_ENV !== 'node', 'shallowMount', () => {
.to.equal('hey')
})

itSkipIf(
typeof Proxy === 'undefined',
it('does not stub unregistered components', () => {
const TestComponent = {
template: '<custom-element />'
}
const wrapper = shallowMount(TestComponent)

expect(wrapper.html())
.to.equal('<custom-element></custom-element>')
})

it(
'stubs lazily registered components', () => {
const Child = {
render: h => h('p')

0 comments on commit fb7a66c

Please sign in to comment.