-
+
-
+
diff --git a/ui/src/Components/SilenceModal/SilenceMatch.test.js b/ui/src/Components/SilenceModal/SilenceMatch.test.js
index 5a8ebb9c9..958a80adc 100644
--- a/ui/src/Components/SilenceModal/SilenceMatch.test.js
+++ b/ui/src/Components/SilenceModal/SilenceMatch.test.js
@@ -2,17 +2,25 @@ import React from "react";
import { shallow } from "enzyme";
-import { NewEmptyMatcher, MatcherValueToObject } from "Stores/SilenceFormStore";
+import {
+ SilenceFormStore,
+ NewEmptyMatcher,
+ MatcherValueToObject
+} from "Stores/SilenceFormStore";
import { SilenceMatch } from "./SilenceMatch";
+let silenceFormStore;
let matcher;
beforeEach(() => {
+ silenceFormStore = new SilenceFormStore();
matcher = NewEmptyMatcher();
});
const ShallowLabelValueInput = () => {
- return shallow();
+ return shallow(
+
+ );
};
describe("", () => {
diff --git a/ui/src/Stores/SilenceFormStore.js b/ui/src/Stores/SilenceFormStore.js
index 0d42ac3b6..600d0bce1 100644
--- a/ui/src/Stores/SilenceFormStore.js
+++ b/ui/src/Stores/SilenceFormStore.js
@@ -44,6 +44,7 @@ class SilenceFormStore {
data = observable(
{
inProgress: false,
+ wasValidated: false,
alertmanagers: [],
matchers: [],
startsAt: moment(),
@@ -70,6 +71,7 @@ class SilenceFormStore {
resetProgress() {
this.inProgress = false;
+ this.wasValidated = false;
},
// append a new empty matcher to the list
diff --git a/ui/src/Stores/SilenceFormStore.test.js b/ui/src/Stores/SilenceFormStore.test.js
index ea690a1d9..6d8e13c32 100644
--- a/ui/src/Stores/SilenceFormStore.test.js
+++ b/ui/src/Stores/SilenceFormStore.test.js
@@ -52,6 +52,13 @@ describe("SilenceFormStore.data", () => {
expect(store.data.inProgress).toBe(false);
});
+ it("resetProgress() sets 'wasValidated' to false", () => {
+ store.data.wasValidated = true;
+ expect(store.data.wasValidated).toBe(true);
+ store.data.resetProgress();
+ expect(store.data.wasValidated).toBe(false);
+ });
+
it("addEmptyMatcher() appends a matcher", () => {
expect(store.data.matchers).toHaveLength(0);
store.data.addEmptyMatcher();