From 879a0fd25272e221e879d5f1978fe5ae3cb35f66 Mon Sep 17 00:00:00 2001 From: guerler Date: Thu, 30 May 2024 18:42:52 +0300 Subject: [PATCH] Adjust jest test with regard to changes in activity panel --- .../ActivityBar/ActivitySettings.test.js | 27 ++++++++++--------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/client/src/components/ActivityBar/ActivitySettings.test.js b/client/src/components/ActivityBar/ActivitySettings.test.js index e5555451ec85..2fd33b00d02e 100644 --- a/client/src/components/ActivityBar/ActivitySettings.test.js +++ b/client/src/components/ActivityBar/ActivitySettings.test.js @@ -19,7 +19,7 @@ function testActivity(id, newOptions = {}) { description: "activity-test-description", icon: "activity-test-icon", mutable: true, - optional: false, + optional: true, title: "activity-test-title", to: null, tooltip: "activity-test-tooltip", @@ -56,22 +56,23 @@ describe("ActivitySettings", () => { it("availability of built-in activities", async () => { const items = wrapper.findAll(activityItemSelector); - expect(items.length).toBe(Activities.length); + const nOptional = Activities.filter((x) => x.optional).length; + expect(items.length).toBe(nOptional); }); - it("visible but non-optional activity", async () => { + it("visible and optional activity", async () => { activityStore.setAll([testActivity("1")]); await wrapper.vm.$nextTick(); const items = wrapper.findAll(activityItemSelector); expect(items.length).toBe(1); - const pinnedCheckbox = items.at(0).find("[data-icon='thumbtack']"); - expect(pinnedCheckbox.exists()).toBeTruthy(); - const pinnedIcon = wrapper.find("[icon='activity-test-icon'"); - expect(pinnedIcon.exists()).toBeTruthy(); + const checkbox = items.at(0).find("[title='Hide in Activity Bar']"); + expect(checkbox.exists()).toBeTruthy(); + const icon = wrapper.find("[icon='activity-test-icon'"); + expect(icon.exists()).toBeTruthy(); expect(activityStore.getAll()[0].visible).toBeTruthy(); - pinnedCheckbox.trigger("click"); + checkbox.trigger("click"); await wrapper.vm.$nextTick(); - expect(activityStore.getAll()[0].visible).toBeTruthy(); + expect(activityStore.getAll()[0].visible).toBeFalsy(); }); it("non-visible but optional activity", async () => { @@ -84,12 +85,12 @@ describe("ActivitySettings", () => { await wrapper.vm.$nextTick(); const items = wrapper.findAll(activityItemSelector); expect(items.length).toBe(1); - const hiddenCheckbox = items.at(0).find("[data-icon='square']"); - expect(hiddenCheckbox.exists()).toBeTruthy(); + const checkbox = items.at(0).find("[title='Show in Activity Bar']"); + expect(checkbox.exists()).toBeTruthy(); expect(activityStore.getAll()[0].visible).toBeFalsy(); - hiddenCheckbox.trigger("click"); + checkbox.trigger("click"); await wrapper.vm.$nextTick(); - const visibleCheckbox = items.at(0).find("[data-icon='check-square']"); + const visibleCheckbox = items.at(0).find("[title='Hide in Activity Bar']"); expect(visibleCheckbox.exists()).toBeTruthy(); expect(activityStore.getAll()[0].visible).toBeTruthy(); });