<div
className={classNames('info-drawer info-drawer-pane', { open: displayed })}
style={{ top }}>
- <div className="close-button">
- <ClearButton aria-label={translate('close')} onClick={onClose} />
- </div>
{displayed && (
- <EscKeydownHandler onKeydown={onClose}>
- <OutsideClickHandler onClickOutside={onClose}>
- <div className="display-flex-column max-height-100">{children}</div>
- </OutsideClickHandler>
- </EscKeydownHandler>
+ <>
+ <div className="close-button">
+ <ClearButton aria-label={translate('close')} onClick={onClose} />
+ </div>
+ <EscKeydownHandler onKeydown={onClose}>
+ <OutsideClickHandler onClickOutside={onClose}>
+ <div className="display-flex-column max-height-100">{children}</div>
+ </OutsideClickHandler>
+ </EscKeydownHandler>
+ </>
)}
</div>
);
*/
import { shallow } from 'enzyme';
import * as React from 'react';
+import { ClearButton } from '../../../../../../components/controls/buttons';
import InfoDrawer, { InfoDrawerProps } from '../InfoDrawer';
it('should render correctly', () => {
it('should call onClose when button is clicked', () => {
const onClose = jest.fn();
- const wrapper = shallowRender({ onClose });
-
- wrapper.find('ClearButton').simulate('click');
+ const wrapper = shallowRender({ onClose, displayed: true });
+ wrapper.find(ClearButton).simulate('click');
expect(onClose).toBeCalled();
});
"top": 120,
}
}
->
- <div
- className="close-button"
- >
- <ClearButton
- aria-label="close"
- onClick={[MockFunction]}
- />
- </div>
-</div>
+/>
`;
exports[`should render correctly: displayed 1`] = `