mirror of
https://github.com/apache/superset.git
synced 2024-09-12 00:29:39 -04:00
fix: Refresh Interval Modal dropdown (#12406)
This commit is contained in:
parent
9618f0786c
commit
ddbcf5b0e9
@ -17,7 +17,7 @@
|
|||||||
* under the License.
|
* under the License.
|
||||||
*/
|
*/
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { mount, shallow } from 'enzyme';
|
import { mount } from 'enzyme';
|
||||||
|
|
||||||
import ModalTrigger from 'src/components/ModalTrigger';
|
import ModalTrigger from 'src/components/ModalTrigger';
|
||||||
import RefreshIntervalModal from 'src/dashboard/components/RefreshIntervalModal';
|
import RefreshIntervalModal from 'src/dashboard/components/RefreshIntervalModal';
|
||||||
@ -66,11 +66,15 @@ describe('RefreshIntervalModal', () => {
|
|||||||
refreshWarning: 'Show warning',
|
refreshWarning: 'Show warning',
|
||||||
};
|
};
|
||||||
|
|
||||||
const wrapper = shallow(<RefreshIntervalModal {...props} />);
|
const wrapper = getMountWrapper(props);
|
||||||
|
wrapper.find('span[role="button"]').simulate('click');
|
||||||
|
|
||||||
wrapper.instance().handleFrequencyChange({ value: 30 });
|
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 });
|
wrapper.instance().handleFrequencyChange({ value: 3601 });
|
||||||
expect(wrapper.find(ModalTrigger).dive().find(Alert)).not.toExist();
|
wrapper.update();
|
||||||
|
expect(wrapper.find(ModalTrigger).find(Alert)).not.toExist();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@ -38,6 +38,12 @@ export const options = [
|
|||||||
[86400, t('24 hours')],
|
[86400, t('24 hours')],
|
||||||
].map(o => ({ value: o[0], label: o[1] }));
|
].map(o => ({ value: o[0], label: o[1] }));
|
||||||
|
|
||||||
|
const StyledModalTrigger = styled(ModalTrigger)`
|
||||||
|
.ant-modal-body {
|
||||||
|
overflow: visible;
|
||||||
|
}
|
||||||
|
`;
|
||||||
|
|
||||||
const RefreshWarningContainer = styled.div`
|
const RefreshWarningContainer = styled.div`
|
||||||
margin-top: ${({ theme }) => theme.gridUnit * 6}px;
|
margin-top: ${({ theme }) => theme.gridUnit * 6}px;
|
||||||
`;
|
`;
|
||||||
@ -103,7 +109,7 @@ class RefreshIntervalModal extends React.PureComponent<
|
|||||||
!!refreshFrequency && !!refreshWarning && refreshFrequency < refreshLimit;
|
!!refreshFrequency && !!refreshWarning && refreshFrequency < refreshLimit;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<ModalTrigger
|
<StyledModalTrigger
|
||||||
ref={this.modalRef}
|
ref={this.modalRef}
|
||||||
triggerNode={this.props.triggerNode}
|
triggerNode={this.props.triggerNode}
|
||||||
modalTitle={t('Refresh Interval')}
|
modalTitle={t('Refresh Interval')}
|
||||||
|
Loading…
Reference in New Issue
Block a user