diff --git a/client/src/components/ActivityBar/ActivitySettings.test.js b/client/src/components/ActivityBar/ActivitySettings.test.js index fc4bfe54338..e5555451ec8 100644 --- a/client/src/components/ActivityBar/ActivitySettings.test.js +++ b/client/src/components/ActivityBar/ActivitySettings.test.js @@ -29,10 +29,7 @@ function testActivity(id, newOptions = {}) { } async function testSearch(wrapper, query, result) { - const searchField = wrapper.find("input"); - searchField.element.value = query; - searchField.trigger("change"); - await wrapper.vm.$nextTick(); + await wrapper.setProps({ query }); const filtered = wrapper.findAll(activityItemSelector); expect(filtered.length).toBe(result); } @@ -48,6 +45,9 @@ describe("ActivitySettings", () => { wrapper = mount(mountTarget, { localVue, pinia, + props: { + query: "", + }, stubs: { icon: { template: "
" }, }, diff --git a/client/src/components/ActivityBar/ActivitySettings.vue b/client/src/components/ActivityBar/ActivitySettings.vue index d210fab4df2..835691d3c0b 100644 --- a/client/src/components/ActivityBar/ActivitySettings.vue +++ b/client/src/components/ActivityBar/ActivitySettings.vue @@ -23,7 +23,7 @@ const activityStore = useActivityStore(); const { activities } = storeToRefs(activityStore); const filteredActivities = computed(() => { - if (props.query.length > 0) { + if (props.query?.length > 0) { const queryLower = props.query.toLowerCase(); const results = activities.value.filter((a: Activity) => { const attributeValues = [a.title, a.description]; diff --git a/client/src/components/admin/AdminPanel.test.js b/client/src/components/admin/AdminPanel.test.js index 33919a126cb..9e038a5249f 100644 --- a/client/src/components/admin/AdminPanel.test.js +++ b/client/src/components/admin/AdminPanel.test.js @@ -14,6 +14,10 @@ jest.mock("@/composables/config", () => ({ })), })); +jest.mock("vue-router/composables", () => ({ + useRoute: jest.fn(() => ({})), +})); + function createTarget(propsData = {}) { return mount(MountTarget, { localVue, diff --git a/client/src/components/admin/AdminPanel.vue b/client/src/components/admin/AdminPanel.vue index b6a5ea2bfd4..9fb87a8ddac 100644 --- a/client/src/components/admin/AdminPanel.vue +++ b/client/src/components/admin/AdminPanel.vue @@ -125,7 +125,9 @@ const sections = computed(() => {