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

Expose the function to resolve ComponentName and live props #378

Open
elevatebart opened this issue Feb 11, 2021 · 3 comments
Open

Expose the function to resolve ComponentName and live props #378

elevatebart opened this issue Feb 11, 2021 · 3 comments
Labels
enhancement New feature or request

Comments

@elevatebart
Copy link
Contributor

As a developer, I would like to use this function to resolve the name and the props passed to a component, to make my passing tests clearer.

It can be useful in the context of component testing, also in designing new ones.

@elevatebart
Copy link
Contributor Author

I will try my hand at a PR for this.

@lmiller1990 lmiller1990 added the enhancement New feature or request label Feb 11, 2021
@nandi95
Copy link
Contributor

nandi95 commented Apr 29, 2021

Accessing wrapper.vm.$props will give you the up to date current props even after update.

resolve the name

What do you mean? The name of the component? If so you already have access to that.

import Button from './UIButton.vue';

console.log(Button.name);

@elevatebart

@elevatebart
Copy link
Contributor Author

Thank you @nandi95 for your answer,

Essentially, I am working on functional components. They do not have names. I would still like to get the name of the function given or the name of the head component. or the name of the file.
The need behind it is to log it properly when it is mounted.

In this order (if one is empty, move to the next):

  • Name of component within parent
  • Name of function defining the component
  • Name of component (an object)
  • Name of file where component is defined

I hope this makes sense

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

No branches or pull requests

3 participants