-
-
Notifications
You must be signed in to change notification settings - Fork 32.6k
Closed
Closed
Copy link
Labels
docsImprovements or additions to the documentationImprovements or additions to the documentationtest
Description
- [ x] The issue is present in the latest release.
- [x ] I have searched the issues of this repository and believe that this is not a duplicate.
Current Behavior 😯
Hi, I'm using the Tabs component and passing all the props that I require using my own wrapper component. Everything is working fine except when I add scrollable prop to the component.
const returnScrollable = () => {
const [value, setValue] = useState(0);
const handleChange = (event, newValue) => {
setValue(newValue);
};
return (
<>
<Tabs
tabItems={tabItemsScrollable} //array of tabs
onChange={handleChange}
value={value}
variant="scrollable"
scrollButtons="auto"
/>
</>
);
};
This works as it's supposed to be without any errors on the console but when I run tests through Jest of updating the snap-shots using storybook, I'm getting an error.
Error: Uncaught [TypeError: Cannot read property 'offsetHeight' of null]
Error: Uncaught [TypeError: Cannot read property 'scrollTop' of null]
The above error occurred in the <ScrollbarSize> component:
in ScrollbarSize (created by ForwardRef(Tabs))
in div (created by ForwardRef(Tabs))
in ForwardRef(Tabs) (created by WithStyles(ForwardRef(Tabs)))
in WithStyles(ForwardRef(Tabs)) (created by SBTabs)
in header (created by ForwardRef(Paper))
in ForwardRef(Paper) (created by WithStyles(ForwardRef(Paper)))
in WithStyles(ForwardRef(Paper)) (created by ForwardRef(AppBar))
in ForwardRef(AppBar) (created by WithStyles(ForwardRef(AppBar)))
in WithStyles(ForwardRef(AppBar)) (created by SBTabs)
in div (created by SBTabs)
in SBTabs (created by WithStyles(SBTabs))
in WithStyles(SBTabs) (created by BaseStoryScrollable)
in BaseStoryScrollable
Expected Behavior 🤔
The tests should pass just like it does when the scrollable prop is not passed on the Tabs component.
Steps to Reproduce 🕹
Steps:
- Create a component using Tabs and try Jest snap-shot testing it.
Context 🔦
Your Environment 🌎
Tech | Version |
---|---|
Material-UI | v4.3.1 |
React | 16.9.0 |
Browser | Chrome |
TypeScript | NA |
etc. |
oliviertassinari, rhermes62, hajjimurad, educastellano and gyutato
Metadata
Metadata
Assignees
Labels
docsImprovements or additions to the documentationImprovements or additions to the documentationtest