Skip to content

Commit

Permalink
feat(monitor condition): Remove the empty default condition creation (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
Ionys320 authored Dec 20, 2024
1 parent efdffca commit 2ecd7af
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 11 deletions.
6 changes: 0 additions & 6 deletions src/components/EditMonitorConditions.vue
Original file line number Diff line number Diff line change
Expand Up @@ -73,12 +73,6 @@ export default {
}
},
created() {
if (this.model.length === 0) {
this.addCondition();
}
},
methods: {
getNewGroup() {
return {
Expand Down
14 changes: 9 additions & 5 deletions test/e2e/specs/monitor-form.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,16 +28,16 @@ test.describe("Monitor Form", () => {
await selectMonitorType(page);

await page.getByTestId("add-condition-button").click();
expect(await page.getByTestId("condition").count()).toEqual(2); // 1 added by default + 1 explicitly added
expect(await page.getByTestId("condition").count()).toEqual(1); // 1 explicitly added

await page.getByTestId("add-group-button").click();
expect(await page.getByTestId("condition-group").count()).toEqual(1);
expect(await page.getByTestId("condition").count()).toEqual(3); // 2 solo conditions + 1 condition in group
expect(await page.getByTestId("condition").count()).toEqual(2); // 1 solo conditions + 1 condition in group

await screenshot(testInfo, page);

await page.getByTestId("remove-condition").first().click();
expect(await page.getByTestId("condition").count()).toEqual(2); // 1 solo condition + 1 condition in group
expect(await page.getByTestId("condition").count()).toEqual(1); // 0 solo condition + 1 condition in group

await page.getByTestId("remove-condition-group").first().click();
expect(await page.getByTestId("condition-group").count()).toEqual(0);
Expand All @@ -60,7 +60,10 @@ test.describe("Monitor Form", () => {
await resolveTypeSelect.getByRole("option", { name: "NS" }).click();

await page.getByTestId("add-condition-button").click();
expect(await page.getByTestId("condition").count()).toEqual(2); // 1 added by default + 1 explicitly added
expect(await page.getByTestId("condition").count()).toEqual(1); // 1 explicitly added

await page.getByTestId("add-condition-button").click();
expect(await page.getByTestId("condition").count()).toEqual(2); // 2 explicitly added

await page.getByTestId("condition-value").nth(0).fill("a.iana-servers.net");
await page.getByTestId("condition-and-or").nth(0).selectOption("or");
Expand Down Expand Up @@ -89,7 +92,8 @@ test.describe("Monitor Form", () => {
await resolveTypeSelect.click();
await resolveTypeSelect.getByRole("option", { name: "NS" }).click();

expect(await page.getByTestId("condition").count()).toEqual(1); // 1 added by default
await page.getByTestId("add-condition-button").click();
expect(await page.getByTestId("condition").count()).toEqual(1); // 1 explicitly added

await page.getByTestId("condition-value").nth(0).fill("definitely-not.net");

Expand Down

0 comments on commit 2ecd7af

Please sign in to comment.