From b29ef29af5f5a815daa55762fb86fb15e30238a7 Mon Sep 17 00:00:00 2001 From: 38elements Date: Thu, 31 May 2018 00:33:17 +0900 Subject: [PATCH] add test for child component --- test/specs/mounting-options/sync.spec.js | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/test/specs/mounting-options/sync.spec.js b/test/specs/mounting-options/sync.spec.js index 7426d1ce4..8f6cb59a4 100644 --- a/test/specs/mounting-options/sync.spec.js +++ b/test/specs/mounting-options/sync.spec.js @@ -113,9 +113,17 @@ describeWithShallowAndMount('options.sync', (mountingMethod) => { }) it('call updated when sync is not false', () => { + const foo_spy = sinon.stub() + const Foo = { + template: '
{{ foo }}
', + props: ['foo'], + updated () { + foo_spy() + } + } const spy = sinon.stub() const TestComponent = { - template: '
{{ foo }}
', + template: '
{{ foo }}
', data () { return { foo: 'foo' @@ -126,10 +134,13 @@ describeWithShallowAndMount('options.sync', (mountingMethod) => { } } const wrapper = mountingMethod(TestComponent, { + stubs: { foo: Foo }, sync: true }) expect(spy.notCalled).to.equal(true) + expect(foo_spy.notCalled).to.equal(true) wrapper.vm.foo = 'bar' expect(spy.calledOnce).to.equal(true) + expect(foo_spy.calledOnce).to.equal(true) }) })