Skip to content

Commit 7bd98e9

Browse files
authored
Merge pull request galaxyproject#20762 from davelopez/fix_wf_comments_unit_tests_warning
Fix WorkflowComment tests warnings
2 parents 5dab4a2 + 631da2b commit 7bd98e9

1 file changed

Lines changed: 20 additions & 1 deletion

File tree

client/src/components/Workflow/Editor/Comments/WorkflowComment.test.ts

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { createTestingPinia } from "@pinia/testing";
22
import { mount, shallowMount } from "@vue/test-utils";
33
import { setActivePinia } from "pinia";
44
import { suppressErrorForCustomIcons } from "tests/jest/helpers";
5-
import { nextTick } from "vue";
5+
import { nextTick, reactive, ref } from "vue";
66

77
import type { LazyUndoRedoAction, UndoRedoAction } from "@/stores/undoRedoStore";
88
import type { TextWorkflowComment } from "@/stores/workflowEditorCommentStore";
@@ -31,6 +31,10 @@ jest.mock("@/composables/workflowStores", () => ({
3131
isJustCreated: () => false,
3232
getCommentMultiSelected: () => false,
3333
},
34+
toolbarStore: reactive({
35+
snapActive: false,
36+
snapDistance: 12,
37+
}),
3438
undoRedoStore: {
3539
applyAction: (action: UndoRedoAction) => action.run(),
3640
applyLazyAction: (action: LazyUndoRedoAction) => {
@@ -41,6 +45,9 @@ jest.mock("@/composables/workflowStores", () => ({
4145
}),
4246
}));
4347

48+
// Mock transform injection that Draggable components expect
49+
const mockTransform = ref({ x: 0, y: 0, k: 1 });
50+
4451
function getStyleProperty(element: Element, property: string) {
4552
const style = element.getAttribute("style") ?? "";
4653

@@ -69,6 +76,9 @@ describe("WorkflowComment", () => {
6976
scale: 1,
7077
rootOffset: {},
7178
},
79+
provide: {
80+
transform: mockTransform,
81+
},
7282
});
7383

7484
const position = () => ({
@@ -110,6 +120,9 @@ describe("WorkflowComment", () => {
110120
scale: 1,
111121
rootOffset: {},
112122
},
123+
provide: {
124+
transform: mockTransform,
125+
},
113126
});
114127

115128
expect(wrapper.findComponent(TextComment).isVisible()).toBe(true);
@@ -133,6 +146,9 @@ describe("WorkflowComment", () => {
133146
scale: 1,
134147
rootOffset: {},
135148
},
149+
provide: {
150+
transform: mockTransform,
151+
},
136152
});
137153

138154
const textComment = wrapper.findComponent(TextComment);
@@ -160,6 +176,9 @@ describe("WorkflowComment", () => {
160176
scale: 1,
161177
rootOffset: {},
162178
},
179+
provide: {
180+
transform: mockTransform,
181+
},
163182
});
164183

165184
const textComment = wrapper.findComponent(TextComment);

0 commit comments

Comments
 (0)