Skip to content

@material-ui/icons 4.11.2 no longer has unique displayNames on icons according to enzyme .name() #23831

Closed
@heath-freenome

Description

@heath-freenome

Prior to 4.11.2 when I used an enzyme wrapper to get the name() of an icon component, it returned the name of each component properly (i.e. the Error icon return ErrorIcon, the Add icon returned AddIcon, etc.). Now all icons return the same name: Memo([object Object])

See the test file in an example code sandbox

  • The issue is present in the latest release.
  • I have searched the issues of this repository and believe that this is not a duplicate.

Current Behavior 😯

The name of all icons in 4.11.2 is Memo([object Object])

Expected Behavior 🤔

The name of every icon in 4.11.2 is the same as they were in 4.9.1

Steps to Reproduce 🕹

Steps:

  1. Using this codesandbox instance, see the tests working properly with 4.9.1
  2. Using this codesandbox instance, see the same tests failing with 4.11.2

Context 🔦

My tests for my applications are checking to see if I have the proper icon being rendered using the name() function on an enzyme wrapper, with this upgrade my tests are breaking.

Your Environment 🌎

An example of a functioning code is found in this code sandbox with @material-ui/icons@4.9.1: https://codesandbox.io/s/brave-galois-hm1mf
An example of the breaking code is found in this code sandbox with @material-ui/icons@4.11.2: https://codesandbox.io/s/nostalgic-brahmagupta-djl98

Tech Version
Material-UI v4.11.2
React 16.14.0
Browser N/A
TypeScript N/A
etc.

Metadata

Metadata

Assignees

No one assigned

    Labels

    component: SvgIconThe React component.out of scopeThe problem looks valid but we won't fix it (maybe we will revisit it in the future)

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions