Skip to content

Commit

Permalink
feat: do not stub unregistered components (#1048)
Browse files Browse the repository at this point in the history
  • Loading branch information
eddyerburgh committed Dec 1, 2018
1 parent 89f4ffc commit fb7a66c
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 4 deletions.
5 changes: 4 additions & 1 deletion packages/create-instance/patch-render.js
Expand Up @@ -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
) {
Expand Down
15 changes: 12 additions & 3 deletions test/specs/shallow-mount.spec.js
Expand Up @@ -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(() => {
Expand Down Expand Up @@ -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')
Expand Down

0 comments on commit fb7a66c

Please sign in to comment.