mirror of
https://github.com/ansible/awx.git
synced 2026-05-19 14:57:39 -02:30
Adjust unit test after adding conditional render to modals in launch button component
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { mountWithContexts, waitForElement } from '@testUtils/enzymeHelpers';
|
import { mountWithContexts } from '@testUtils/enzymeHelpers';
|
||||||
import { sleep } from '@testUtils/testUtils';
|
import { sleep } from '@testUtils/testUtils';
|
||||||
|
|
||||||
import LaunchButton from './LaunchButton';
|
import LaunchButton from './LaunchButton';
|
||||||
@@ -70,20 +70,15 @@ describe('LaunchButton', () => {
|
|||||||
const wrapper = mountWithContexts(
|
const wrapper = mountWithContexts(
|
||||||
<LaunchButton resource={resource}>{children}</LaunchButton>
|
<LaunchButton resource={resource}>{children}</LaunchButton>
|
||||||
);
|
);
|
||||||
const button = wrapper.find('button');
|
expect(wrapper.find('Modal').length).toBe(0);
|
||||||
button.prop('onClick')();
|
wrapper.find('button').prop('onClick')();
|
||||||
await waitForElement(
|
await sleep(0);
|
||||||
wrapper,
|
wrapper.update();
|
||||||
'Modal.at-c-alertModal--danger',
|
expect(wrapper.find('Modal').length).toBe(1);
|
||||||
el => el.props().isOpen === true && el.props().title === 'Error!'
|
wrapper.find('ModalBoxCloseButton').simulate('click');
|
||||||
);
|
await sleep(0);
|
||||||
const modalCloseButton = wrapper.find('ModalBoxCloseButton');
|
wrapper.update();
|
||||||
modalCloseButton.simulate('click');
|
expect(wrapper.find('Modal').length).toBe(0);
|
||||||
await waitForElement(
|
|
||||||
wrapper,
|
|
||||||
'Modal.at-c-alertModal--danger',
|
|
||||||
el => el.props().isOpen === false
|
|
||||||
);
|
|
||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user