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 b29ef29
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 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 foo_spy = sinon.stub()
const Foo = {
template: '<div>{{ foo }}</div>',
props: ['foo'],
updated () {
foo_spy()
}
}
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,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)
})
})

0 comments on commit b29ef29

Please sign in to comment.