diff --git a/client/src/components/Form/Elements/FormData/FormData.test.js b/client/src/components/Form/Elements/FormData/FormData.test.js index c77f3dd02682..b4abfc230de5 100644 --- a/client/src/components/Form/Elements/FormData/FormData.test.js +++ b/client/src/components/Form/Elements/FormData/FormData.test.js @@ -224,4 +224,37 @@ describe("FormData", () => { values: [{ id: "hda2", map_over_type: null, src: "hda" }], }); }); + + it("linked and unlinked batch mode handling", async () => { + const wrapper = createTarget({ + value: null, + flavor: "module", + options: defaultOptions, + }); + expect(wrapper.emitted().input[0][0]).toEqual({ + batch: false, + product: false, + values: [{ id: "hda3", map_over_type: null, src: "hda" }], + }); + await wrapper.find("[title='Multiple datasets'").trigger("click"); + expect(wrapper.emitted().input[1][0]).toEqual({ + batch: true, + product: false, + values: [{ id: "hda3", map_over_type: null, src: "hda" }], + }); + const checkLinked = wrapper.find("input[type='checkbox']"); + expect(wrapper.find(".custom-switch span").text()).toBe( + "Linked: Datasets will be run in matched order with other datasets." + ); + expect(checkLinked.element.checked).toBeTruthy(); + await checkLinked.setChecked(false); + expect(wrapper.find(".custom-switch span").text()).toBe( + "Unlinked: Dataset will be run against *all* other datasets." + ); + expect(wrapper.emitted().input[2][0]).toEqual({ + batch: true, + product: true, + values: [{ id: "hda3", map_over_type: null, src: "hda" }], + }); + }); }); diff --git a/client/src/components/Form/Elements/FormData/FormData.vue b/client/src/components/Form/Elements/FormData/FormData.vue index 234b68b5ef08..5234b6577d5b 100644 --- a/client/src/components/Form/Elements/FormData/FormData.vue +++ b/client/src/components/Form/Elements/FormData/FormData.vue @@ -425,7 +425,7 @@ onMounted(() => { * Watch and set current value if user switches to a different select field */ watch( - () => currentVariant.value, + () => [currentLinked.value, currentVariant.value], () => { setValue(currentValue.value); } @@ -480,11 +480,11 @@ watch( v-model="currentLinked" class="no-highlight my-2" switch> -