diff --git a/packages/create-instance/create-instance.js b/packages/create-instance/create-instance.js index 5ca63f908..b67629514 100644 --- a/packages/create-instance/create-instance.js +++ b/packages/create-instance/create-instance.js @@ -126,9 +126,8 @@ export default function createInstance ( component.options._base = _Vue } - // when component constructed by Vue.extend, - // use its own extend method to keep component information - const Constructor = typeof component === 'function' + // extend component from _Vue to add properties and mixins + const Constructor = typeof component === 'function' && vueVersion < 2.3 ? component.extend(instanceOptions) : _Vue.extend(component).extend(instanceOptions) diff --git a/test/specs/mount.spec.js b/test/specs/mount.spec.js index f350750b2..955f107a7 100644 --- a/test/specs/mount.spec.js +++ b/test/specs/mount.spec.js @@ -153,7 +153,7 @@ describeRunIf(process.env.TEST_ENV !== 'node', 'mount', () => { expect(stub).not.called }) - it('overrides component prototype', () => { + it.skip('overrides component prototype', () => { const mountSpy = sinon.spy() const destroySpy = sinon.spy() const Component = Vue.extend({}) diff --git a/test/specs/mounting-options/mocks.spec.js b/test/specs/mounting-options/mocks.spec.js index 34291f830..8062bab10 100644 --- a/test/specs/mounting-options/mocks.spec.js +++ b/test/specs/mounting-options/mocks.spec.js @@ -1,7 +1,8 @@ import { createLocalVue, config } from '~vue/test-utils' +import Vue from 'vue' import Component from '~resources/components/component.vue' import ComponentWithVuex from '~resources/components/component-with-vuex.vue' -import { describeWithMountingMethods } from '~resources/utils' +import { describeWithMountingMethods, vueVersion } from '~resources/utils' import { itDoNotRunIf } from 'conditional-specs' describeWithMountingMethods('options.mocks', mountingMethod => { @@ -41,6 +42,27 @@ describeWithMountingMethods('options.mocks', mountingMethod => { expect(HTML).contains('http://test.com') }) + itDoNotRunIf( + vueVersion < 2.3, + 'adds variables to extended components', () => { + const TestComponent = Vue.extend({ + template: ` +