-
Notifications
You must be signed in to change notification settings - Fork 669
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
this.$children is empty in the created lifecycle hook #827
Comments
This is however a bug with synchronous behavior. You can either fix it by setting it("renders with content", (done) => {
// ..
const tabs = mount(Tabs, { localVue, slots: { default: content }, sync: false });
setTimeout(() => {
expect(tabs.html()).toContain("li");
done()
})
}); Or force the component to re render: it("renders with content", () => {
// ..
const tabs = mount(Tabs, { localVue, slots: { default: content } });
tabs.vm.$forceUpdate()
expect(tabs.html()).toContain("li");
}); |
I've released beta.29 which uses Vue Since this is an edge case, and there is a workaround we won't fix this issue. The solution going forward is to set |
Version
1.0.0-beta.20
Reproduction link
https://codesandbox.io/s/q89qro9yq?module=%2Fsrc%2Fcomponents%2FTabs.spec.js
Steps to reproduce
What is expected?
The
mount
function in the test will render the tabs component as it is seen in the browser on the right, with threeli
elements in theul
element representing the three child tab components.What is actually happening?
In the tabs component, there is a created lifecycle hook:
This works in the browser, but
$children
is empty when rendered byvue-test-utils
.This results in the
li
elements (which are produced by iterating over thistabs
data field) are not rendered.The text was updated successfully, but these errors were encountered: