From 6dc5ba68fcc0880db32f67160cc6c0b1a08749b9 Mon Sep 17 00:00:00 2001 From: eddyerburgh Date: Sun, 3 Mar 2019 06:51:55 +0000 Subject: [PATCH 1/2] fix: stub model option --- .../create-instance/create-component-stubs.js | 1 + test/specs/shallow-mount.spec.js | 22 +++++++++++++++++++ 2 files changed, 23 insertions(+) diff --git a/packages/create-instance/create-component-stubs.js b/packages/create-instance/create-component-stubs.js index d2dc4ce07..5b6660761 100644 --- a/packages/create-instance/create-component-stubs.js +++ b/packages/create-instance/create-component-stubs.js @@ -38,6 +38,7 @@ function getCoreProperties(componentOptions: Component): Object { return { attrs: componentOptions.attrs, name: componentOptions.name, + model: componentOptions.model, props: componentOptions.props, on: componentOptions.on, key: componentOptions.key, diff --git a/test/specs/shallow-mount.spec.js b/test/specs/shallow-mount.spec.js index 1e22aad0b..fc2f902b7 100644 --- a/test/specs/shallow-mount.spec.js +++ b/test/specs/shallow-mount.spec.js @@ -554,4 +554,26 @@ describeRunIf(process.env.TEST_ENV !== 'node', 'shallowMount', () => { ) } ) + + it('stubs model', () => { + const ChildComponent = { + template: '
', + model: { + prop: 'a', + event: 'change' + }, + props: ['a'] + } + const TestComponent = { + template: '', + data() { + return { + val: '123' + } + }, + components: { ChildComponent } + } + const wrapper = shallowMount(TestComponent) + expect(wrapper.find(ChildComponent).vm.a).to.equal('123') + }) }) From 064d59130cc656a70ec7f61877c855568dc670dd Mon Sep 17 00:00:00 2001 From: eddyerburgh Date: Sun, 3 Mar 2019 07:04:25 +0000 Subject: [PATCH 2/2] test: only run model test on Vue > 2.2 --- test/specs/shallow-mount.spec.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/specs/shallow-mount.spec.js b/test/specs/shallow-mount.spec.js index fc2f902b7..807c3f4e2 100644 --- a/test/specs/shallow-mount.spec.js +++ b/test/specs/shallow-mount.spec.js @@ -555,7 +555,7 @@ describeRunIf(process.env.TEST_ENV !== 'node', 'shallowMount', () => { } ) - it('stubs model', () => { + itDoNotRunIf(vueVersion < 2.2, 'stubs model', () => { const ChildComponent = { template: '
', model: {