Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/develop' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
siarhei-epam committed Oct 8, 2024
2 parents 3ac1d81 + 8058a95 commit 3fa144c
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 5 deletions.
12 changes: 11 additions & 1 deletion public/docs/content/examples-labeledInput-Basic.json
Original file line number Diff line number Diff line change
@@ -1 +1,11 @@
{"object":"value","document":{"object":"document","data":{},"nodes":[{"object":"block","type":"paragraph","data":{},"nodes":[{"object":"text","text":"Basic LabeledInput usage","marks":[]}]}]}}
[
{
"type": "paragraph",
"data": {},
"children": [
{
"text": "Basic LabeledInput usage"
}
]
}
]
4 changes: 2 additions & 2 deletions uui-core/src/data/forms/__tests__/useForm.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -625,7 +625,7 @@ describe('useForm', () => {

it('Should unblock router when form is saved', async () => {
const saveMock = jest.fn().mockResolvedValue(true);
const beforeLeaveMock = jest.fn().mockResolvedValue(false);
const beforeLeaveMock = jest.fn().mockRejectedValue(false);
const { wrapper, testUuiCtx: svc } = getDefaultUUiContextWrapper();
const props = {
value: testData,
Expand Down Expand Up @@ -676,7 +676,7 @@ describe('useForm', () => {
expect(beforeLeaveMock).toHaveBeenCalledTimes(1);
});

it('Should make redirect and lock form aging if beforeLeave return "remain"', async () => {
it('Should make redirect and lock form aging if beforeLeave returns "remain"', async () => {
const saveMock = jest.fn().mockResolvedValue(true);
const beforeLeaveMock = jest.fn().mockResolvedValue('remain');
const { wrapper, testUuiCtx: svc } = getDefaultUUiContextWrapper();
Expand Down
4 changes: 2 additions & 2 deletions uui-core/src/data/forms/useForm.ts
Original file line number Diff line number Diff line change
Expand Up @@ -259,9 +259,9 @@ export function useForm<T>(props: UseFormProps<T>): IFormApi<T> {
}
flushSync(() => {
resetForm(newState);
removeUnsavedChanges();
unblock();
});
removeUnsavedChanges();
unblock();

if (propsRef.current.onSuccess && response) {
propsRef.current.onSuccess(response.form, isSavedBeforeLeave);
Expand Down

0 comments on commit 3fa144c

Please sign in to comment.