fix: making buttons not displaying

This commit is contained in:
anastasiia-developer 2022-04-20 17:59:16 +03:00
parent d55df5af8b
commit f25746a242
2 changed files with 8 additions and 13 deletions

View File

@ -35,14 +35,12 @@ class Json extends React.PureComponent<JsonProps> {
<JsonViewerWrap>
<SampleControls>
{renderCopyButton()}
<button
onClick={this.expandAll}
style={{ display: showFoldingButtons ? 'inline-block' : 'none' }}
> Expand all </button>
<button
onClick={this.collapseAll}
style={{ display: showFoldingButtons ? 'inline-block' : 'none' }}
> Collapse all </button>
{showFoldingButtons &&
<>
<button onClick={this.expandAll}> Expand all </button>
<button onClick={this.collapseAll}> Collapse all </button>
</>
}
</SampleControls>
<OptionsContext.Consumer>
{(options) => (

View File

@ -47,11 +47,8 @@ describe('Components', () => {
const flatData = { a: 1, b: '2', c: null };
const flatDataComponent = mount(withTheme(<JsonViewer data={flatData} />));
const expandButton = flatDataComponent.find('div > button[children=" Expand all "]');
expect(expandButton.html()).toContain('display: none');
const collapseButton = flatDataComponent.find('div > button[children=" Collapse all "]');
expect(collapseButton.html()).toContain('display: none');
expect(flatDataComponent.html()).not.toContain('Expand all');
expect(flatDataComponent.html()).not.toContain('Collapse all');
});
});
});