mirror of
https://github.com/outline/outline.git
synced 2026-11-29 00:29:36 +03:00
* Initial plan * Fix draft auto-delete check for non-empty untitled docs --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
32 lines
737 B
TypeScript
32 lines
737 B
TypeScript
import { shouldAutoDeleteDraftOnUnmount } from "./useDocumentSave";
|
|
|
|
describe("shouldAutoDeleteDraftOnUnmount", () => {
|
|
const baseOptions = {
|
|
title: "",
|
|
createdById: "user-1",
|
|
currentUserId: "user-1",
|
|
isDraft: true,
|
|
isActive: true,
|
|
hasEmptyTitle: true,
|
|
isPersistedOnce: true,
|
|
};
|
|
|
|
it("does not auto delete drafts with non-empty editor content", () => {
|
|
expect(
|
|
shouldAutoDeleteDraftOnUnmount({
|
|
...baseOptions,
|
|
isEditorEmpty: false,
|
|
})
|
|
).toBe(false);
|
|
});
|
|
|
|
it("auto deletes drafts that are still empty and untitled", () => {
|
|
expect(
|
|
shouldAutoDeleteDraftOnUnmount({
|
|
...baseOptions,
|
|
isEditorEmpty: true,
|
|
})
|
|
).toBe(true);
|
|
});
|
|
});
|