Skip to content

Commit

Permalink
fix: Refresh Interval Modal dropdown (apache#12406)
Browse files Browse the repository at this point in the history
  • Loading branch information
agatapst authored and amitmiran137 committed Jan 14, 2021
1 parent 8334093 commit fb9e9d8
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
* under the License.
*/
import React from 'react';
import { mount, shallow } from 'enzyme';
import { mount } from 'enzyme';

import ModalTrigger from 'src/components/ModalTrigger';
import RefreshIntervalModal from 'src/dashboard/components/RefreshIntervalModal';
Expand Down Expand Up @@ -66,11 +66,15 @@ describe('RefreshIntervalModal', () => {
refreshWarning: 'Show warning',
};

const wrapper = shallow(<RefreshIntervalModal {...props} />);
const wrapper = getMountWrapper(props);
wrapper.find('span[role="button"]').simulate('click');

wrapper.instance().handleFrequencyChange({ value: 30 });
expect(wrapper.find(ModalTrigger).dive().find(Alert)).toExist();
wrapper.update();
expect(wrapper.find(ModalTrigger).find(Alert)).toExist();

wrapper.instance().handleFrequencyChange({ value: 3601 });
expect(wrapper.find(ModalTrigger).dive().find(Alert)).not.toExist();
wrapper.update();
expect(wrapper.find(ModalTrigger).find(Alert)).not.toExist();
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,12 @@ export const options = [
[86400, t('24 hours')],
].map(o => ({ value: o[0], label: o[1] }));

const StyledModalTrigger = styled(ModalTrigger)`
.ant-modal-body {
overflow: visible;
}
`;

const RefreshWarningContainer = styled.div`
margin-top: ${({ theme }) => theme.gridUnit * 6}px;
`;
Expand Down Expand Up @@ -103,7 +109,7 @@ class RefreshIntervalModal extends React.PureComponent<
!!refreshFrequency && !!refreshWarning && refreshFrequency < refreshLimit;

return (
<ModalTrigger
<StyledModalTrigger
ref={this.modalRef}
triggerNode={this.props.triggerNode}
modalTitle={t('Refresh Interval')}
Expand Down

0 comments on commit fb9e9d8

Please sign in to comment.