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> <JsonViewerWrap>
<SampleControls> <SampleControls>
{renderCopyButton()} {renderCopyButton()}
<button {showFoldingButtons &&
onClick={this.expandAll} <>
style={{ display: showFoldingButtons ? 'inline-block' : 'none' }} <button onClick={this.expandAll}> Expand all </button>
> Expand all </button> <button onClick={this.collapseAll}> Collapse all </button>
<button </>
onClick={this.collapseAll} }
style={{ display: showFoldingButtons ? 'inline-block' : 'none' }}
> Collapse all </button>
</SampleControls> </SampleControls>
<OptionsContext.Consumer> <OptionsContext.Consumer>
{(options) => ( {(options) => (

View File

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