fix: use the correct i18n key for an empty group name (#9163)
This commit is contained in:
1 parent
f3a1c36d51
commit
2b0fcbbc33
2 files changed
+26
-1
No files matched your search
@@ -99,3 +99,28 @@ describe("registration result handling", () => {
|
||||
expect(mocks.error).not.toHaveBeenCalled();
|
||||
});
|
||||
});
|
||||
|
||||
describe("group details", () => {
|
||||
beforeEach(() => {
|
||||
vi.stubGlobal("definePageMeta", vi.fn());
|
||||
vi.stubGlobal("useRouter", () => ({ push: mocks.push }));
|
||||
});
|
||||
|
||||
afterEach(() => vi.unstubAllGlobals());
|
||||
|
||||
test("rejects a blank group name with the required field message", async () => {
|
||||
const wrapper = mount({ ...RegistrationPage, render: () => null });
|
||||
const vm = wrapper.vm as unknown as {
|
||||
groupDetails: { groupName: { value: string }; next: () => Promise<void> };
|
||||
groupErrorMessages: string[];
|
||||
};
|
||||
try {
|
||||
vm.groupDetails.groupName.value = " ";
|
||||
await vm.groupDetails.next();
|
||||
expect(vm.groupErrorMessages).toEqual([i18n.global.t("validators.required")]);
|
||||
}
|
||||
finally {
|
||||
wrapper.unmount();
|
||||
}
|
||||
});
|
||||
});
|
||||
@@ -395,7 +395,7 @@ const { validate: validGroupName, valid: groupNameValid } = useAsyncValidator(
|
||||
);
|
||||
async function validateGroup() {
|
||||
if (!groupName.value || !groupName.value.trim()) {
|
||||
groupErrorMessages.value = [i18n.t("validation.required")];
|
||||
groupErrorMessages.value = [i18n.t("validators.required")];
|
||||
return false;
|
||||
}
|
||||
groupErrorMessages.value = [];
|
||||
|
||||
Reference in new issue
Block a user