Skip to content

Commit

Permalink
Improve SelectPreferredStore.vue.
Browse files Browse the repository at this point in the history
  • Loading branch information
jmchilton committed Mar 13, 2023
1 parent 8adbece commit 682cdf1
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -60,4 +60,27 @@ describe("SelectPreferredStore.vue", () => {
const emitted = wrapper.emitted();
expect(emitted["updated"][0][0]).toEqual(null);
});

it("updates object store to on non-null selection", async () => {
const wrapper = mountComponent();
await flushPromises();
const els = wrapper.findAll(PREFERENCES.object_store_selection.option_buttons.selector);
expect(els.length).toBe(3);
const galaxyDefaultOption = wrapper.find(
PREFERENCES.object_store_selection.option_button({ object_store_id: "object_store_2" }).selector
);
expect(galaxyDefaultOption.exists()).toBeTruthy();
axiosMock
.onPut(
`/api/histories/${TEST_HISTORY_ID}`,
expect.objectContaining({ preferred_object_store_id: "object_store_2" })
)
.reply(202);
await galaxyDefaultOption.trigger("click");
await flushPromises();
const errorEl = wrapper.find(".object-store-selection-error");
expect(errorEl.exists()).toBeFalsy();
const emitted = wrapper.emitted();
expect(emitted["updated"][0][0]).toEqual("object_store_2");
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -19,28 +19,26 @@ const props = defineProps({
const error = ref<string | null>(null);
const selectedObjectStoreId = ref(props.history.preferred_object_store_id);
const newDatasetsDescription = ref("New dataset outputs from tools and workflows executed in this history");
const galaxySelectionDefaultTitle = ref("Use Galaxy Defaults");
const galaxySelectionDefaultDescription = ref(
"Selecting this will reset Galaxy to default behaviors configured by your Galaxy administrator."
);
const userSelectionDefaultTitle = ref("Use Your User Preference Defaults");
const userSelectionDefaultDescription = ref(
"Selecting this will cause the history to not set a default and to fallback to your user preference defined default."
);
const newDatasetsDescription = "New dataset outputs from tools and workflows executed in this history";
const galaxySelectionDefaultTitle = "Use Galaxy Defaults";
const galaxySelectionDefaultDescription =
"Selecting this will reset Galaxy to default behaviors configured by your Galaxy administrator.";
const userSelectionDefaultTitle = "Use Your User Preference Defaults";
const userSelectionDefaultDescription =
"Selecting this will cause the history to not set a default and to fallback to your user preference defined default.";
const defaultOptionTitle = computed(() => {
if (props.userPreferredObjectStoreId) {
return userSelectionDefaultTitle.value;
return userSelectionDefaultTitle;
} else {
return galaxySelectionDefaultTitle.value;
return galaxySelectionDefaultTitle;
}
});
const defaultOptionDescription = computed(() => {
if (props.userPreferredObjectStoreId) {
return userSelectionDefaultDescription.value;
return userSelectionDefaultDescription;
} else {
return galaxySelectionDefaultDescription.value;
return galaxySelectionDefaultDescription;
}
});
Expand Down

0 comments on commit 682cdf1

Please sign in to comment.