Commit af1fadd1 authored by ap4y's avatar ap4y

Do not update yaml preview with errors in policy editor

parent b5fa3a62
...@@ -146,7 +146,7 @@ export default { ...@@ -146,7 +146,7 @@ export default {
} }
}, },
changeEditorMode(mode) { changeEditorMode(mode) {
if (mode === EditorModeYAML) { if (mode === EditorModeYAML && !this.hasParsingError) {
this.yamlEditorValue = toYaml(this.policy); this.yamlEditorValue = toYaml(this.policy);
} }
......
...@@ -215,6 +215,16 @@ spec: ...@@ -215,6 +215,16 @@ spec:
it('disables add rule button', () => { it('disables add rule button', () => {
expect(findAddRuleButton().props('disabled')).toBe(true); expect(findAddRuleButton().props('disabled')).toBe(true);
}); });
it('does not update yaml editor value on switch to yaml editor', async () => {
findPolicyName().vm.$emit('input', 'test-policy');
wrapper.find("[data-testid='editor-mode']").vm.$emit('input', EditorModeYAML);
await wrapper.vm.$nextTick();
const editor = findNetworkPolicyEditor();
expect(editor.exists()).toBe(true);
expect(editor.props('value')).toEqual('');
});
}); });
it('creates policy and redirects to a threat monitoring path', async () => { it('creates policy and redirects to a threat monitoring path', async () => {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment