@carlonicora/nextjs-jsonapi 6.29.0 → 6.29.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{BlockNoteEditor-KGCHQQVY.js → BlockNoteEditor-K4HWQLPJ.js} +15 -15
- package/dist/{BlockNoteEditor-KGCHQQVY.js.map → BlockNoteEditor-K4HWQLPJ.js.map} +1 -1
- package/dist/{BlockNoteEditor-BHCNJ2JA.mjs → BlockNoteEditor-TDX2RC7I.mjs} +2 -2
- package/dist/billing/index.js +378 -378
- package/dist/billing/index.mjs +1 -1
- package/dist/{chunk-UQFDOZVF.mjs → chunk-OVSR72CZ.mjs} +378 -377
- package/dist/chunk-OVSR72CZ.mjs.map +1 -0
- package/dist/{chunk-WXTEAATG.js → chunk-QI4SCGPB.js} +4 -3
- package/dist/chunk-QI4SCGPB.js.map +1 -0
- package/dist/client/index.js +2 -2
- package/dist/client/index.mjs +1 -1
- package/dist/components/forms/EditorSheet.d.ts.map +1 -1
- package/dist/components/index.js +2 -2
- package/dist/components/index.mjs +1 -1
- package/dist/contexts/index.js +2 -2
- package/dist/contexts/index.mjs +1 -1
- package/dist/email-automations/index.js +78 -78
- package/dist/email-automations/index.mjs +1 -1
- package/dist/features/analytics/index.js +107 -107
- package/dist/features/analytics/index.mjs +1 -1
- package/dist/features/blog/index.js +93 -93
- package/dist/features/blog/index.mjs +1 -1
- package/dist/features/help/index.js +31 -31
- package/dist/features/help/index.mjs +1 -1
- package/dist/features/tokenusage/index.js +102 -102
- package/dist/features/tokenusage/index.mjs +1 -1
- package/package.json +1 -1
- package/src/components/forms/EditorSheet.tsx +7 -2
- package/src/components/forms/__tests__/EditorSheet.spec.tsx +36 -0
- package/dist/chunk-UQFDOZVF.mjs.map +0 -1
- package/dist/chunk-WXTEAATG.js.map +0 -1
- /package/dist/{BlockNoteEditor-BHCNJ2JA.mjs.map → BlockNoteEditor-TDX2RC7I.mjs.map} +0 -0
|
@@ -344,6 +344,42 @@ describe("EditorSheet", () => {
|
|
|
344
344
|
});
|
|
345
345
|
});
|
|
346
346
|
|
|
347
|
+
describe("edit form seeding", () => {
|
|
348
|
+
function EntityEditor({ name }: { name: string }) {
|
|
349
|
+
const form = useForm<TestValues>({ resolver: zodResolver(schema), defaultValues: { name } });
|
|
350
|
+
return (
|
|
351
|
+
<EditorSheet
|
|
352
|
+
form={form}
|
|
353
|
+
onSubmit={vi.fn().mockResolvedValue({ id: "123" })}
|
|
354
|
+
onReset={() => ({ name })}
|
|
355
|
+
entityType="Test Entity"
|
|
356
|
+
isEdit={true}
|
|
357
|
+
module={testModule}
|
|
358
|
+
>
|
|
359
|
+
<input {...form.register("name")} data-testid="name-input" />
|
|
360
|
+
</EditorSheet>
|
|
361
|
+
);
|
|
362
|
+
}
|
|
363
|
+
|
|
364
|
+
it("opens the first time with the entity as it is now, not as it was at mount", async () => {
|
|
365
|
+
const r = render(<EntityEditor name="Old" />);
|
|
366
|
+
// The page saved a newer value (e.g. autosaved content) before the sheet ever opened.
|
|
367
|
+
r.rerender(<EntityEditor name="New" />);
|
|
368
|
+
|
|
369
|
+
await userEvent.click(document.querySelector('[data-help="editor.edit"]') as HTMLElement);
|
|
370
|
+
|
|
371
|
+
expect(screen.getByTestId("name-input")).toHaveValue("New");
|
|
372
|
+
});
|
|
373
|
+
|
|
374
|
+
it("keeps the mount values on the first open when the entity did not change", async () => {
|
|
375
|
+
render(<EntityEditor name="Same" />);
|
|
376
|
+
|
|
377
|
+
await userEvent.click(document.querySelector('[data-help="editor.edit"]') as HTMLElement);
|
|
378
|
+
|
|
379
|
+
expect(screen.getByTestId("name-input")).toHaveValue("Same");
|
|
380
|
+
});
|
|
381
|
+
});
|
|
382
|
+
|
|
347
383
|
describe("Activity hide and reveal (back/forward)", () => {
|
|
348
384
|
it("uncontrolled sheet is closed and the form reset after Activity reveal", async () => {
|
|
349
385
|
const page = (mode: "visible" | "hidden") => (
|