You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

25 lines
747 B

import Vue from 'vue'
describe('Options parent', () => {
it('should work', () => {
const parent = new Vue({}).$mount()
const child = new Vue({
parent: parent
}).$mount()
// this option is straight-forward
// it should register 'parent' as a $parent for 'child'
// and push 'child' to $children array on 'parent'
expect(child.$options.parent).toBeDefined()
expect(child.$options.parent).toEqual(parent)
expect(child.$parent).toBeDefined()
expect(child.$parent).toEqual(parent)
expect(parent.$children).toContain(child)
// destroy 'child' and check if it was removed from 'parent' $children
child.$destroy()
expect(parent.$children.length).toEqual(0)
parent.$destroy()
})
})