MenuList integration tests have dependencies on instance methods #14756
Labels
component: list
This is the name of the generic UI component, not the React module!
component: menu
This is the name of the generic UI component, not the React module!
The MenuList integration tests currently have dependencies on three different instance methods:
focus
,setTabIndex
, andresetTabIndex
. Thefocus
method appears to have been added to MenuList purely for testing reasons and can be fully removed once the test is no longer dependent on it. The other two instance methods were being used to force a condition to get to 100% test coverage, but it is also possible to hit that condition by putting focus to a MenuItem before the MenuListcomponentDidMount
executes.Context 🔦
As part of the work for #8191 I'm going to be converting MenuList to a function component instead of a class. Instance methods will no longer be accessible at that point. This is one nice benefit of converting to function components -- it reduces the surface area of internal details that are possible for developers to abuse. Even though none of the instance methods are documented, with enough developers using Material-UI someone will use some of those instance methods for some odd reason just because they exist.
I will be submitting a pull request within the next day that addresses this.
Your Environment 🌎
The text was updated successfully, but these errors were encountered: