fix: Refresh Interval Modal dropdown (#12406)

This commit is contained in:
Agata Stawarz
2021-01-11 20:58:28 +01:00
committed by GitHub
parent 9618f0786c
commit ddbcf5b0e9
2 changed files with 15 additions and 5 deletions

View File

@@ -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';
@@ -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();
});
});