Skip to content

Commit

Permalink
Adjust jest test with regard to changes in activity panel
Browse files Browse the repository at this point in the history
  • Loading branch information
guerler committed May 30, 2024
1 parent e29a870 commit 879a0fd
Showing 1 changed file with 14 additions and 13 deletions.
27 changes: 14 additions & 13 deletions client/src/components/ActivityBar/ActivitySettings.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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 () => {
Expand All @@ -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();
});
Expand Down

0 comments on commit 879a0fd

Please sign in to comment.