Skip to content

Commit

Permalink
add test for child component
Browse files Browse the repository at this point in the history
  • Loading branch information
38elements committed May 30, 2018
1 parent d09045a commit 9e9a863
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion test/specs/mounting-options/sync.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -113,9 +113,17 @@ describeWithShallowAndMount('options.sync', (mountingMethod) => {
})

it('call updated when sync is not false', () => {
const fooSpy = sinon.stub()
const Foo = {
template: '<div>{{ foo }}</div>',
props: ['foo'],
updated () {
fooSpy()
}
}
const spy = sinon.stub()
const TestComponent = {
template: '<div>{{ foo }}</div>',
template: '<div>{{ foo }}<foo :foo="foo" /></div>',
data () {
return {
foo: 'foo'
Expand All @@ -126,10 +134,14 @@ describeWithShallowAndMount('options.sync', (mountingMethod) => {
}
}
const wrapper = mountingMethod(TestComponent, {
stubs: { foo: Foo },
sync: true
})
expect(spy.notCalled).to.equal(true)
expect(fooSpy.notCalled).to.equal(true)
wrapper.vm.foo = 'bar'
expect(spy.calledOnce).to.equal(true)
expect(fooSpy.calledOnce).to.equal(true)
expect(wrapper.html()).to.equal('<div>bar<div>bar</div></div>')
})
})

0 comments on commit 9e9a863

Please sign in to comment.