Skip to content

Commit

Permalink
Fix and add test case for linked/unlinked batch mode selection
Browse files Browse the repository at this point in the history
  • Loading branch information
guerler committed Aug 23, 2023
1 parent 5b84b26 commit 7e84105
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 3 deletions.
33 changes: 33 additions & 0 deletions client/src/components/Form/Elements/FormData/FormData.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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" }],
});
});
});
6 changes: 3 additions & 3 deletions client/src/components/Form/Elements/FormData/FormData.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down Expand Up @@ -480,11 +480,11 @@ watch(
v-model="currentLinked"
class="no-highlight my-2"
switch>
<div v-if="currentLinked">
<span v-if="currentLinked">
<FontAwesomeIcon icon="fa-link" />
<b v-localize class="mr-1">Linked:</b>
<span v-localize>Datasets will be run in matched order with other datasets.</span>
</div>
</span>
<span v-else>
<FontAwesomeIcon icon="fa-unlink" />
<b v-localize class="mr-1">Unlinked:</b>
Expand Down

0 comments on commit 7e84105

Please sign in to comment.