8000 improve async component test case with props and events · cdxfish/vue@ff6395e · GitHub
[go: up one dir, main page]

Skip to content

Commit ff6395e

Browse files
committed
improve async component test case with props and events
1 parent 6ec3ac5 commit ff6395e

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

test/unit/specs/async_component_spec.js

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,22 @@ describe('Async components', function () {
1515
})
1616

1717
it('normal', function (done) {
18+
var go = jasmine.createSpy()
1819
new Vue({
1920
el: el,
20-
template: '<test></test>',
21+
template: '<test hi="ok" @ready="go"></test>',
22+
methods: {
23+
go: go
24+
},
2125
components: {
2226
test: function (resolve) {
2327
setTimeout(function () {
2428
resolve({
25-
template: 'ok'
29+
props: ['hi'],
30+
template: '{{ hi }}',
31+
ready: function () {
32+
this.$emit('ready')
33+
}
2634
})
2735
next()
2836
}, 0)
@@ -31,6 +39,7 @@ describe('Async components', function () {
3139
})
3240
function next () {
3341
expect(el.textContent).toBe('ok')
42+
expect(go).toHaveBeenCalled()
3443
done()
3544
}
3645
})

0 commit comments

Comments
 (0)
0