mirror of
https://github.com/ansible/awx.git
synced 2026-03-19 09:57:33 -02:30
add VariablesField expand test
This commit is contained in:
@@ -136,4 +136,27 @@ describe('VariablesField', () => {
|
|||||||
|
|
||||||
expect(wrapper.find('CodeEditor').prop('mode')).toEqual('javascript');
|
expect(wrapper.find('CodeEditor').prop('mode')).toEqual('javascript');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('should open modal when expanded', async () => {
|
||||||
|
const value = '---';
|
||||||
|
const wrapper = mountWithContexts(
|
||||||
|
<Formik initialValues={{ variables: value }} onSubmit={jest.fn()}>
|
||||||
|
{formik => (
|
||||||
|
<form onSubmit={formik.handleSubmit}>
|
||||||
|
<VariablesField id="the-field" name="variables" label="Variables" />
|
||||||
|
<button type="submit" id="submit">
|
||||||
|
Submit
|
||||||
|
</button>
|
||||||
|
</form>
|
||||||
|
)}
|
||||||
|
</Formik>
|
||||||
|
);
|
||||||
|
expect(wrapper.find('Modal').prop('isOpen')).toEqual(false);
|
||||||
|
|
||||||
|
wrapper.find('Button[variant="plain"]').invoke('onClick')();
|
||||||
|
wrapper.update();
|
||||||
|
|
||||||
|
expect(wrapper.find('Modal').prop('isOpen')).toEqual(true);
|
||||||
|
expect(wrapper.find('Modal CodeEditor')).toHaveLength(1);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user