Skip to content

Commit 08dd24f

Browse files
committed
more test cases
1 parent 43ccd4c commit 08dd24f

File tree

1 file changed

+25
-1
lines changed

1 file changed

+25
-1
lines changed

test/unit/specs/compiler/compile_spec.js

+25-1
Original file line numberDiff line numberDiff line change
@@ -270,7 +270,29 @@ if (_.inBrowser) {
270270
expect(childSpy).toHaveBeenCalledWith(2)
271271
})
272272

273-
it('should remove transcluded directives from parent when unlinking', function (done) {
273+
it('should remove transcluded directives from parent when unlinking (v-component)', function () {
274+
var vm = new Vue({
275+
el: el,
276+
template:
277+
'<div v-component="test">{{test}}</div>',
278+
data: {
279+
test: 'parent'
280+
},
281+
components: {
282+
test: {
283+
template: '<content></content>'
284+
}
285+
}
286+
})
287+
expect(vm.$el.textContent).toBe('parent')
288+
expect(vm._directives.length).toBe(2)
289+
expect(vm._children.length).toBe(1)
290+
vm._children[0].$destroy()
291+
expect(vm._directives.length).toBe(1)
292+
expect(vm._children.length).toBe(0)
293+
})
294+
295+
it('should remove transcluded directives from parent when unlinking (v-if + v-component)', function (done) {
274296
var vm = new Vue({
275297
el: el,
276298
template:
@@ -289,10 +311,12 @@ if (_.inBrowser) {
289311
})
290312
expect(vm.$el.textContent).toBe('parent')
291313
expect(vm._directives.length).toBe(3)
314+
expect(vm._children.length).toBe(1)
292315
vm.ok = false
293316
_.nextTick(function () {
294317
expect(vm.$el.textContent).toBe('')
295318
expect(vm._directives.length).toBe(1)
319+
expect(vm._children.length).toBe(0)
296320
done()
297321
})
298322
})

0 commit comments

Comments
 (0)