From c6159a7c3e1755a813b19a9f37c433b6ea86a3b3 Mon Sep 17 00:00:00 2001 From: Keith Grant Date: Thu, 23 Jan 2020 11:15:33 -0800 Subject: [PATCH] add more VariablesDetail tests --- .../CodeMirrorInput/VariablesDetail.test.jsx | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/awx/ui_next/src/components/CodeMirrorInput/VariablesDetail.test.jsx b/awx/ui_next/src/components/CodeMirrorInput/VariablesDetail.test.jsx index b99fda9f16..05548f8aa8 100644 --- a/awx/ui_next/src/components/CodeMirrorInput/VariablesDetail.test.jsx +++ b/awx/ui_next/src/components/CodeMirrorInput/VariablesDetail.test.jsx @@ -63,4 +63,20 @@ describe('', () => { expect(input.prop('mode')).toEqual('javascript'); expect(input.prop('value')).toEqual('{\n "bar": "baz"\n}'); }); + + test('should default yaml value to "---"', () => { + const wrapper = shallow(); + const input = wrapper.find('Styled(CodeMirrorInput)'); + expect(input.prop('value')).toEqual('---'); + }); + + test('should default empty json to "{}"', () => { + const wrapper = mount(); + act(() => { + wrapper.find('YamlJsonToggle').invoke('onChange')('javascript'); + }); + wrapper.setProps({ value: '' }); + const input = wrapper.find('Styled(CodeMirrorInput)'); + expect(input.prop('value')).toEqual('{}'); + }); });