Skip to content

Commit

Permalink
improve async component test case with props and events
Browse files Browse the repository at this point in the history
  • Loading branch information
yyx990803 committed Jan 30, 2016
1 parent 6ec3ac5 commit ff6395e
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions test/unit/specs/async_component_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,22 @@ describe('Async components', function () {
})

it('normal', function (done) {
var go = jasmine.createSpy()
new Vue({
el: el,
template: '<test></test>',
template: '<test hi="ok" @ready="go"></test>',
methods: {
go: go
},
components: {
test: function (resolve) {
setTimeout(function () {
resolve({
template: 'ok'
props: ['hi'],
template: '{{ hi }}',
ready: function () {
this.$emit('ready')
}
})
next()
}, 0)
Expand All @@ -31,6 +39,7 @@ describe('Async components', function () {
})
function next () {
expect(el.textContent).toBe('ok')
expect(go).toHaveBeenCalled()
done()
}
})
Expand Down

0 comments on commit ff6395e

Please sign in to comment.