Skip to content
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

How do you ensure a global is being set to child components from mount? #183

Open
d1820 opened this issue Mar 26, 2019 · 1 comment
Open

Comments

@d1820
Copy link

d1820 commented Mar 26, 2019

I am mounting an instance of a component and I am setting the globals, when the component is rendered the child components dont have the global available. Am i missing something or doing it wrong?

I have tried

mount(component, { globals: { $myref: 'xxx' }});

and

const instance =  Vue.extend();
options.instance.prototype.$myref= 'xxx';
mount(component, options);

and

const instance =  Vue.extend();
options.instance.prototype.$myref= 'xxx';
options.globals = { $myref: 'xxx' };
mount(component, options);

in all the mounted component has $myref

but the child always shows undefined.

Any ideas or help would be great.

Thanks

@eddyerburgh
Copy link
Owner

Is the child component created with Vue.extend? If so then this library doesn't support adding globals. I recommend using @vue/test-utils instead.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants