Skip to content

Fix find issue #962

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Sep 8, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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