})
test('createRecord', () => {
- expect(createRecord('test1', {})).toBe(true)
+ expect(createRecord('test1')).toBe(true)
// if id has already been created, should return false
- expect(createRecord('test1', {})).toBe(false)
+ expect(createRecord('test1')).toBe(false)
})
test('rerender', async () => {
__hmrId: childId,
render: compileToFunction(`<div><slot/></div>`)
}
- createRecord(childId, Child)
+ createRecord(childId)
const Parent: ComponentOptions = {
__hmrId: parentId,
`<div @click="count++">{{ count }}<Child>{{ count }}</Child></div>`
)
}
- createRecord(parentId, Parent)
+ createRecord(parentId)
render(h(Parent), root)
expect(serializeInner(root)).toBe(`<div>0<div>0</div></div>`)
unmounted: unmountSpy,
render: compileToFunction(`<div @click="count++">{{ count }}</div>`)
}
- createRecord(childId, Child)
+ createRecord(childId)
const Parent: ComponentOptions = {
render: () => h(Child)
},
render: compileToFunction(template)
}
- createRecord(id, Comp)
+ createRecord(id)
render(h(Comp), root)
expect(serializeInner(root)).toBe(
},
render: compileToFunction(`<div>{{ msg }}</div>`)
}
- createRecord(childId, Child)
+ createRecord(childId)
const Parent: ComponentOptions = {
__hmrId: parentId,
components: { Child },
render: compileToFunction(`<Child msg="foo" />`)
}
- createRecord(parentId, Parent)
+ createRecord(parentId)
render(h(Parent), root)
expect(serializeInner(root)).toBe(`<div>foo</div>`)
__hmrId: childId,
render: compileToFunction(`<div>child</div>`)
}
- createRecord(childId, Child)
+ createRecord(childId)
const Parent: ComponentOptions = {
__hmrId: parentId,
components: { Child },
render: compileToFunction(`<Child class="test" />`)
}
- createRecord(parentId, Parent)
+ createRecord(parentId)
render(h(Parent), root)
expect(serializeInner(root)).toBe(`<div class="test">child</div>`)
__hmrId: childId,
render: compileToFunction(`<div>child</div>`)
}
- createRecord(childId, Child)
+ createRecord(childId)
const components: ComponentOptions[] = []
}
}
- createRecord(parentId, parentComp)
+ createRecord(parentId)
}
const last = components[components.length - 1]