Skip to content

Commit 9e9a863

Browse files
committed
add test for child component
1 parent d09045a commit 9e9a863

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

Diff for: test/specs/mounting-options/sync.spec.js

+13-1
Original file line numberDiff line numberDiff line change
@@ -113,9 +113,17 @@ describeWithShallowAndMount('options.sync', (mountingMethod) => {
113113
})
114114

115115
it('call updated when sync is not false', () => {
116+
const fooSpy = sinon.stub()
117+
const Foo = {
118+
template: '<div>{{ foo }}</div>',
119+
props: ['foo'],
120+
updated () {
121+
fooSpy()
122+
}
123+
}
116124
const spy = sinon.stub()
117125
const TestComponent = {
118-
template: '<div>{{ foo }}</div>',
126+
template: '<div>{{ foo }}<foo :foo="foo" /></div>',
119127
data () {
120128
return {
121129
foo: 'foo'
@@ -126,10 +134,14 @@ describeWithShallowAndMount('options.sync', (mountingMethod) => {
126134
}
127135
}
128136
const wrapper = mountingMethod(TestComponent, {
137+
stubs: { foo: Foo },
129138
sync: true
130139
})
131140
expect(spy.notCalled).to.equal(true)
141+
expect(fooSpy.notCalled).to.equal(true)
132142
wrapper.vm.foo = 'bar'
133143
expect(spy.calledOnce).to.equal(true)
144+
expect(fooSpy.calledOnce).to.equal(true)
145+
expect(wrapper.html()).to.equal('<div>bar<div>bar</div></div>')
134146
})
135147
})

0 commit comments

Comments
 (0)