Skip to content

Commit

Permalink
fix: do not remove cached constructors (#962)
Browse files Browse the repository at this point in the history
* fix: do not removed cached constructors

* test: fix linting error
  • Loading branch information
eddyerburgh authored Sep 8, 2018
1 parent 88ffc98 commit 71ec3b9
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 20 deletions.
3 changes: 0 additions & 3 deletions packages/create-instance/create-instance.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,6 @@ export default function createInstance (
options: Options,
_Vue: Component
): Component {
// Remove cached constructor
delete component._Ctor

// make sure all extends are based on this instance
_Vue.options._base = _Vue

Expand Down
2 changes: 0 additions & 2 deletions packages/server-test-utils/src/renderToString.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,6 @@ export default function renderToString (
`renderToString must be run in node. It cannot be ` + `run in a browser`
)
}
// Remove cached constructor
delete component._Ctor

if (options.attachToDocument) {
throwError(`you cannot use attachToDocument with ` + `renderToString`)
Expand Down
7 changes: 0 additions & 7 deletions packages/shared/create-component-stubs.js
Original file line number Diff line number Diff line change
Expand Up @@ -149,11 +149,6 @@ export function createStubsFromStubsObject (
return acc
}

if (originalComponents[stubName]) {
// Remove cached constructor
delete originalComponents[stubName]._Ctor
}

if (typeof stub === 'string') {
acc[stubName] = createStubFromString(
stub,
Expand Down Expand Up @@ -195,8 +190,6 @@ function stubComponents (
)
return
}
// Remove cached constructor
delete componentOptions._Ctor

stubbedComponents[component] = createStubFromComponent(
cmp,
Expand Down
3 changes: 0 additions & 3 deletions packages/test-utils/src/mount.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,6 @@ export default function mount (

warnIfNoWindow()

// Remove cached constructor
delete component._Ctor

const elm = options.attachToDocument ? createElement() : undefined

const mergedOptions = mergeOptions(options, config)
Expand Down
17 changes: 12 additions & 5 deletions test/specs/wrapper/find.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -291,16 +291,23 @@ describeWithShallowAndMount('find', mountingMethod => {
expect(wrapper.find(Component).vnode).to.be.an('object')
})

it('returns array of VueWrappers of Vue Components matching component if component name in parent is different to filename', () => {
it('returns Wrapper matching selector using Wrapper as reference', () => {
const wrapper = mountingMethod(ComponentWithChild)
const div = wrapper.find('span')
expect(div.find(Component).vnode).to.be.an('object')
})

it('returns Wrapper matching selector using Wrapper as reference', () => {
const wrapper = mountingMethod(ComponentWithChild)
const div = wrapper.find('span')
expect(div.find(Component).vnode).to.be.an('object')
it('selector works between mounts', () => {
const ChildComponent = { template: '<div />' }
const TestComponent = {
template: '<child-component />',
components: {
ChildComponent
}
}
const wrapper = mountingMethod(TestComponent)
mountingMethod(ChildComponent)
expect(wrapper.find(ChildComponent).vnode).to.be.an('object')
})

it('returns error Wrapper if Vue component is below Wrapper', () => {
Expand Down

0 comments on commit 71ec3b9

Please sign in to comment.