From f25746a242661687823389c1cba49a276b0d61b0 Mon Sep 17 00:00:00 2001 From: anastasiia-developer Date: Wed, 20 Apr 2022 17:59:16 +0300 Subject: [PATCH] fix: making buttons not displaying --- src/components/JsonViewer/JsonViewer.tsx | 14 ++++++-------- src/components/__tests__/JsonViewer.tsx | 7 ++----- 2 files changed, 8 insertions(+), 13 deletions(-) diff --git a/src/components/JsonViewer/JsonViewer.tsx b/src/components/JsonViewer/JsonViewer.tsx index ec0e00a6..f55cd19c 100644 --- a/src/components/JsonViewer/JsonViewer.tsx +++ b/src/components/JsonViewer/JsonViewer.tsx @@ -35,14 +35,12 @@ class Json extends React.PureComponent { {renderCopyButton()} - - + {showFoldingButtons && + <> + + + + } {(options) => ( diff --git a/src/components/__tests__/JsonViewer.tsx b/src/components/__tests__/JsonViewer.tsx index e82c8f82..35b5d179 100644 --- a/src/components/__tests__/JsonViewer.tsx +++ b/src/components/__tests__/JsonViewer.tsx @@ -47,11 +47,8 @@ describe('Components', () => { const flatData = { a: 1, b: '2', c: null }; const flatDataComponent = mount(withTheme()); - 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'); }); }); });