mirror of
https://github.com/ansible/awx.git
synced 2026-01-12 10:30:03 -03:30
add value assertions to code editor tests
This commit is contained in:
parent
c975f65bbc
commit
143d41fb2a
@ -10,11 +10,12 @@ describe('CodeEditor', () => {
|
||||
it('should trigger onChange prop', () => {
|
||||
const onChange = jest.fn();
|
||||
const wrapper = mount(
|
||||
<CodeEditor value="---\n" onChange={onChange} mode="yaml" />
|
||||
<CodeEditor value="---" onChange={onChange} mode="yaml" />
|
||||
);
|
||||
const aceEditor = wrapper.find('AceEditor');
|
||||
expect(aceEditor.prop('mode')).toEqual('yaml');
|
||||
expect(aceEditor.prop('setOptions').readOnly).toEqual(false);
|
||||
expect(aceEditor.prop('value')).toEqual('---');
|
||||
aceEditor.prop('onChange')('newvalue');
|
||||
expect(onChange).toHaveBeenCalledWith('newvalue');
|
||||
});
|
||||
@ -22,9 +23,10 @@ describe('CodeEditor', () => {
|
||||
it('should render in read only mode', () => {
|
||||
const onChange = jest.fn();
|
||||
const wrapper = mount(
|
||||
<CodeEditor value="---\n" onChange={onChange} mode="yaml" readOnly />
|
||||
<CodeEditor value="---" onChange={onChange} mode="yaml" readOnly />
|
||||
);
|
||||
const aceEditor = wrapper.find('AceEditor');
|
||||
expect(aceEditor.prop('setOptions').readOnly).toEqual(true);
|
||||
expect(aceEditor.prop('value')).toEqual('---');
|
||||
});
|
||||
});
|
||||
|
||||
@ -40,6 +40,7 @@ describe('VariablesField', () => {
|
||||
});
|
||||
wrapper.update();
|
||||
expect(wrapper.find('CodeEditor').prop('mode')).toEqual('javascript');
|
||||
expect(wrapper.find('CodeEditor').prop('value')).toEqual('{}');
|
||||
const buttons2 = wrapper.find('Button');
|
||||
expect(buttons2.at(0).prop('variant')).toEqual('secondary');
|
||||
expect(buttons2.at(1).prop('variant')).toEqual('primary');
|
||||
@ -69,6 +70,7 @@ describe('VariablesField', () => {
|
||||
expect(field.prop('hasErrors')).toEqual(true);
|
||||
expect(wrapper.find('.pf-m-error')).toHaveLength(1);
|
||||
});
|
||||
|
||||
it('should render tooltip', () => {
|
||||
const value = '---\n';
|
||||
const wrapper = mountWithContexts(
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user