mirror of
https://github.com/Redocly/redoc.git
synced 2025-08-06 05:10:20 +03:00
make null value checks
Co-authored-by: Roman Hotsiy <gotsijroman@gmail.com>
This commit is contained in:
parent
8f72da450d
commit
d55df5af8b
|
@ -27,8 +27,8 @@ class Json extends React.PureComponent<JsonProps> {
|
|||
}
|
||||
|
||||
renderInner = ({ renderCopyButton }) => {
|
||||
const showFoldingButtons = Object.values(this.props.data).some(
|
||||
(value) => typeof value === 'object',
|
||||
const showFoldingButtons = this.props.data && Object.values(this.props.data).some(
|
||||
(value) => typeof value === 'object' && value !== null,
|
||||
);
|
||||
|
||||
return (
|
||||
|
|
|
@ -44,7 +44,7 @@ describe('Components', () => {
|
|||
});
|
||||
|
||||
test('Expand/Collapse buttons disappears for flat structures', () => {
|
||||
const flatData = { a: 1, b: '2' };
|
||||
const flatData = { a: 1, b: '2', c: null };
|
||||
const flatDataComponent = mount(withTheme(<JsonViewer data={flatData} />));
|
||||
|
||||
const expandButton = flatDataComponent.find('div > button[children=" Expand all "]');
|
||||
|
|
Loading…
Reference in New Issue
Block a user