Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Add displayName #376

Merged
merged 1 commit into from
Apr 20, 2018
Merged

Add displayName #376

merged 1 commit into from
Apr 20, 2018

Conversation

binomialstew
Copy link

Using react@16.3 and enzyme@3.3.x to test, the name of the component is now <t> when previously in react@16.2 it was <ReactTooltip>. Setting the displayName property on the component class ensures the name will remain as ReactTooltip. For example, using enzyme:

expect(ShallowInstance.children().last().name()).to.equal('ReactTooltip')

@aronhelser
Copy link
Collaborator

Awesome, thanks!

If you would like your fix to trigger a release, reformat the commit message commitizen-style, like this:

fix(index): Add displayName

@binomialstew
Copy link
Author

I'm glad to contribute. Thanks for the tooltip. I hadn't seen commitizen before. Do you want me to close and reopen with the updated commit message?

@binomialstew
Copy link
Author

@aronhelser, I found that this is actually due to changes in webpack 4, and the name is retained when using development mode. For example, in karma.config.js:

module.exports = {
  ...
  webpack: {
    ...
    mode: 'development',
    ...
  }
}

Anyway, I still think it isn't a bad idea to define your displayName, in case you'd still like to merge this PR.

@aronhelser aronhelser merged commit 2364dc6 into ReactTooltip:master Apr 20, 2018
@aronhelser
Copy link
Collaborator

Thanks!

@aronhelser
Copy link
Collaborator

🎉 This PR is included in version 3.5.1 🎉

The release is available on:

Your semantic-release bot 📦🚀

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

Successfully merging this pull request may close these issues.

3 participants