diff --git a/web-console/src/components/rule-editor/__snapshots__/rule-editor.spec.tsx.snap b/web-console/src/components/rule-editor/__snapshots__/rule-editor.spec.tsx.snap index e1e7c49c98a..43d59de1691 100644 --- a/web-console/src/components/rule-editor/__snapshots__/rule-editor.spec.tsx.snap +++ b/web-console/src/components/rule-editor/__snapshots__/rule-editor.spec.tsx.snap @@ -1,6 +1,6 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`rule editor matches snapshot 1`] = ` +exports[`rule editor matches snapshot no tier in rule 1`] = `
@@ -213,3 +213,1323 @@ exports[`rule editor matches snapshot 1`] = `
`; + +exports[`rule editor matches snapshot with existing tier and non existing tier in rule 1`] = ` +
+
+ +
+ +
+
+
+
+
+
+
+
+ + + + + double-caret-vertical + + + + +
+
+ +
+
+
+
+
+
+
+ +
+
+ +
+
+ + +
+
+ +
+ + + + + double-caret-vertical + + + + +
+ +
+
+ +
+
+ +
+
+ + +
+
+ +
+ + + + + double-caret-vertical + + + + +
+ +
+
+
+ +
+
+
+
+
+
+
+
+`; + +exports[`rule editor matches snapshot with existing tier in rule 1`] = ` +
+
+ +
+ +
+
+
+
+
+
+
+
+ + + + + double-caret-vertical + + + + +
+
+ +
+
+
+
+
+
+
+ +
+
+ +
+
+ + +
+
+ +
+ + + + + double-caret-vertical + + + + +
+ +
+
+
+ +
+
+
+
+
+
+
+
+`; + +exports[`rule editor matches snapshot with non existing tier in rule 1`] = ` +
+
+ +
+ +
+
+
+
+
+
+
+
+ + + + + double-caret-vertical + + + + +
+
+ +
+
+
+
+
+
+
+ +
+
+ +
+
+ + +
+
+ +
+ + + + + double-caret-vertical + + + + +
+ +
+
+
+ +
+
+
+
+
+
+
+
+`; diff --git a/web-console/src/components/rule-editor/rule-editor.spec.tsx b/web-console/src/components/rule-editor/rule-editor.spec.tsx index fc945a33868..36aeb1c0223 100644 --- a/web-console/src/components/rule-editor/rule-editor.spec.tsx +++ b/web-console/src/components/rule-editor/rule-editor.spec.tsx @@ -22,7 +22,7 @@ import React from 'react'; import { RuleEditor } from './rule-editor'; describe('rule editor', () => { - it('matches snapshot', () => { + it('matches snapshot no tier in rule', () => { const ruleEditor = ( { const { container } = render(ruleEditor); expect(container.firstChild).toMatchSnapshot(); }); + + it('matches snapshot with non existing tier in rule', () => { + const ruleEditor = ( + {}} + onDelete={() => {}} + moveUp={null} + moveDown={null} + /> + ); + const { container } = render(ruleEditor); + expect(container.firstChild).toMatchSnapshot(); + }); + + it('matches snapshot with existing tier in rule', () => { + const ruleEditor = ( + {}} + onDelete={() => {}} + moveUp={null} + moveDown={null} + /> + ); + const { container } = render(ruleEditor); + expect(container.firstChild).toMatchSnapshot(); + }); + + it('matches snapshot with existing tier and non existing tier in rule', () => { + const ruleEditor = ( + {}} + onDelete={() => {}} + moveUp={null} + moveDown={null} + /> + ); + const { container } = render(ruleEditor); + expect(container.firstChild).toMatchSnapshot(); + }); }); diff --git a/web-console/src/components/rule-editor/rule-editor.tsx b/web-console/src/components/rule-editor/rule-editor.tsx index f811adcdbef..cf861c09959 100644 --- a/web-console/src/components/rule-editor/rule-editor.tsx +++ b/web-console/src/components/rule-editor/rule-editor.tsx @@ -102,8 +102,11 @@ export const RuleEditor = React.memo(function RuleEditor(props: RuleEditorProps) onChange(RuleUtil.renameTieredReplicants(rule, tier, e.target.value)) } > + {tiers - .filter(t => t === tier || !tieredReplicants[t]) + .filter(t => t !== tier && !tieredReplicants[t]) .map(t => { return (