You've already forked joplin
mirror of
https://github.com/laurent22/joplin.git
synced 2025-07-13 00:10:37 +02:00
Desktop: Fixes #10737: Fix Fix editing notes in "Conflicts" causes them to temporarily vanish (#10913)
This commit is contained in:
@ -5,6 +5,7 @@ import useFormNote, { HookDependencies } from './useFormNote';
|
||||
import shim from '@joplin/lib/shim';
|
||||
import Resource from '@joplin/lib/models/Resource';
|
||||
import { join } from 'path';
|
||||
import { formNoteToNote } from '.';
|
||||
|
||||
const defaultFormNoteProps: HookDependencies = {
|
||||
syncStarted: false,
|
||||
@ -82,6 +83,39 @@ describe('useFormNote', () => {
|
||||
formNote.unmount();
|
||||
});
|
||||
|
||||
|
||||
// Lacking is_conflict has previously caused UI issues. See https://github.com/laurent22/joplin/pull/10913
|
||||
// for details.
|
||||
it('should preserve value of is_conflict on save', async () => {
|
||||
const testNote = await Note.save({ title: 'Test Note!', is_conflict: 1 });
|
||||
|
||||
const makeFormNoteProps = (): HookDependencies => {
|
||||
return {
|
||||
...defaultFormNoteProps,
|
||||
noteId: testNote.id,
|
||||
};
|
||||
};
|
||||
|
||||
const formNote = renderHook(props => useFormNote(props), {
|
||||
initialProps: makeFormNoteProps(),
|
||||
});
|
||||
await formNote.waitFor(() => {
|
||||
expect(formNote.result.current.formNote).toMatchObject({
|
||||
is_conflict: 1,
|
||||
title: testNote.title,
|
||||
});
|
||||
});
|
||||
|
||||
// Should preserve is_conflict after save.
|
||||
expect(await formNoteToNote(formNote.result.current.formNote)).toMatchObject({
|
||||
is_conflict: 1,
|
||||
deleted_time: 0,
|
||||
title: testNote.title,
|
||||
});
|
||||
|
||||
formNote.unmount();
|
||||
});
|
||||
|
||||
// It seems this test is crashing the worker on CI (out of memory), so disabling it for now.
|
||||
|
||||
// it('should reload the note when it is changed outside of the editor', async () => {
|
||||
|
Reference in New Issue
Block a user