fix(alert/report): add/edit modal issue (#12955)

* fix alert modal

* add test for edit modal
This commit is contained in:
Lily Kuang
2021-02-16 11:18:39 -08:00
committed by GitHub
parent 44723eabbe
commit f10dbbe0ac
3 changed files with 37 additions and 16 deletions

View File

@@ -105,6 +105,11 @@ describe('AlertReportModal', () => {
expect(wrapper.find(Modal)).toExist();
});
it('render a empty modal', () => {
expect(wrapper.find('input[name="name"]').text()).toEqual('');
expect(wrapper.find('input[name="description"]').text()).toEqual('');
});
it('renders add header for report when no alert is included, and isReport is true', async () => {
const addWrapper = await mountAndWait();
@@ -126,10 +131,22 @@ describe('AlertReportModal', () => {
).toEqual('Add Alert');
});
it.skip('renders edit header when alert prop is included', () => {
it('renders edit modal', async () => {
const props = {
...mockedProps,
alert: mockData,
};
const editWrapper = await mountAndWait(props);
expect(
wrapper.find('[data-test="alert-report-modal-title"]').text(),
editWrapper.find('[data-test="alert-report-modal-title"]').text(),
).toEqual('Edit Report');
expect(editWrapper.find('input[name="name"]').props().value).toEqual(
'test report',
);
expect(editWrapper.find('input[name="description"]').props().value).toEqual(
'test report description',
);
});
// Fields