@marimo-team/islands 0.25.3-dev388 → 0.25.3-dev394
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/{ConnectedDataExplorerComponent-BpCrAeX0.js → ConnectedDataExplorerComponent-1DGGwl88.js} +9 -9
- package/dist/{ErrorBoundary-_mFP3LkM.js → ErrorBoundary-DDIASniH.js} +6 -6
- package/dist/{abnfDiagram-VCTEODGH-ZqNgGZlz.js → abnfDiagram-VCTEODGH-CeQEbVik.js} +2 -2
- package/dist/{any-language-editor-CFbAr7vc.js → any-language-editor-C_s_ZoaK.js} +2 -2
- package/dist/{architectureDiagram-5GKGNRK7-BEUaR96d.js → architectureDiagram-5GKGNRK7-C8xUpTAb.js} +1 -1
- package/dist/{assertNever-5uYEbJc8.js → assertNever-DXGfUmPW.js} +2 -2
- package/dist/assets/__vite-browser-external-C9HF3uHE.js +1 -0
- package/dist/assets/worker-B4Cpvr8b.js +171 -0
- package/dist/{chat-ui-BKSYhGMh.js → chat-ui-B6bY_0LF.js} +774 -774
- package/dist/{check-BbhVyViy.js → check-ywinAQy6.js} +1 -1
- package/dist/{chunk-IMKFNOWR-BdEPmWQI.js → chunk-IMKFNOWR-DY7AWyNi.js} +1 -1
- package/dist/{chunk-SHT3W25Y-IvvXM3xf.js → chunk-SHT3W25Y-D4epY9MY.js} +1 -1
- package/dist/{chunk-SVP7TREG-C_qpJUv1.js → chunk-SVP7TREG-CKsl2Q6r.js} +1 -1
- package/dist/{chunk-TICWLB2K-C4agYVWP.js → chunk-TICWLB2K-CMsD2y0F.js} +1 -1
- package/dist/{classDiagram-ZZMXUADV-CT2iq8uF.js → classDiagram-ZZMXUADV-C4FsLnvt.js} +2 -2
- package/dist/{classDiagram-v2-VYDZK3BY-Coe_dD0r.js → classDiagram-v2-VYDZK3BY-BJRuFZeI.js} +2 -2
- package/dist/{code-visibility-DkMNjdNe.js → code-visibility-CByYqwFv.js} +13 -13
- package/dist/{common-Ces9ooG_.js → common-KkgATX2Y.js} +4918 -4910
- package/dist/{config-DJ8M-gPL.js → config-DOwBtRkI.js} +3 -3
- package/dist/{copy-icon-xWvA8ybp.js → copy-icon-BKcX0ltw.js} +2 -2
- package/dist/{createReducer-fp0gX_9U.js → createReducer-Bjx6kuxh.js} +1 -1
- package/dist/{cynefinDiagram-5FMLGOSQ-D0LKziUu.js → cynefinDiagram-5FMLGOSQ-DyI_lSsn.js} +1 -1
- package/dist/{dagre-GXQ25YYZ-Cmgziaw8.js → dagre-GXQ25YYZ-Buoy6sX-.js} +1 -1
- package/dist/{data-grid-overlay-editor-uNMslVKY.js → data-grid-overlay-editor-BHrTJhN3.js} +1 -1
- package/dist/{diagram-S7CK7UJ4-D-lZsALU.js → diagram-S7CK7UJ4-CbSD1DUy.js} +1 -1
- package/dist/{diagram-UQ7AKVKN-TcbdsFoT.js → diagram-UQ7AKVKN-Dapj2rQm.js} +1 -1
- package/dist/{diagram-VX7I27RA-D5BqZi1q.js → diagram-VX7I27RA-CxA3txtC.js} +1 -1
- package/dist/{diagram-Z3DM3KII-MNc7jqvr.js → diagram-Z3DM3KII-BEZqz916.js} +1 -1
- package/dist/{dialog-Cm0VGdxc.js → dialog-mwa6XN15.js} +2 -2
- package/dist/{dropdown-menu-DfamXjVI.js → dropdown-menu-CmgUseHo.js} +5 -5
- package/dist/duckdb-keywords-CdzX4o33.js +3 -0
- package/dist/{ebnfDiagram-PWID7BFC-Cxt6ywyX.js → ebnfDiagram-PWID7BFC-Dmw-1JV3.js} +2 -2
- package/dist/{erDiagram-RLTQ6QDP-BLF-askI.js → erDiagram-RLTQ6QDP-DZpG4cbm.js} +1 -1
- package/dist/{error-banner-k06CAftu.js → error-banner-CHPLqogX.js} +1 -1
- package/dist/{error-entries-rtPWQkJk.js → error-entries-Bk96zt4w.js} +825 -690
- package/dist/{feedback-button-i960qUnq.js → feedback-button-2FaWjlaR.js} +12 -12
- package/dist/{flowDiagram-HODETNUW-CsLw2mWn.js → flowDiagram-HODETNUW-B02oHnBv.js} +2 -2
- package/dist/{formats-DQ-qq-dU.js → formats-BDqe9cfr.js} +1 -1
- package/dist/{glide-data-editor-_EEhlGzS.js → glide-data-editor-B9Yq6Wg1.js} +11 -11
- package/dist/{glide-utils-CHrghEu-.js → glide-utils-DYKWS2YV.js} +2 -2
- package/dist/{globals-DKkjIolp.js → globals-S4D5AVKN.js} +3 -3
- package/dist/{html-to-image-B5nTOeMI.js → html-to-image-BauFF9F_.js} +4842 -4821
- package/dist/{infoDiagram-27XIBGKW-CdSApBWg.js → infoDiagram-27XIBGKW-BPbQHO9m.js} +1 -1
- package/dist/{ishikawaDiagram-5VMMS53U-BnzQ8SI5.js → ishikawaDiagram-5VMMS53U-DmnKSNi7.js} +1 -1
- package/dist/{kanban-definition-UXKFOSKX-D2llTpeX.js → kanban-definition-UXKFOSKX-u5PZbsBe.js} +1 -1
- package/dist/main.js +6236 -6175
- package/dist/{mermaid-BcNMyKmf.js → mermaid-ffopDjig.js} +34 -34
- package/dist/{mindmap-definition-YA3MSWOX-uoEsfD5R.js → mindmap-definition-YA3MSWOX-CX187lhP.js} +1 -1
- package/dist/{number-overlay-editor-D5U7jbrh.js → number-overlay-editor-l7DB2HCO.js} +1 -1
- package/dist/{pegDiagram-XKGWAZYB-DTWrE0S4.js → pegDiagram-XKGWAZYB-Bj6HGPak.js} +2 -2
- package/dist/{pencil-weySvN0N.js → pencil-CijoRsa3.js} +1 -1
- package/dist/{pieDiagram-E7YTZNPT-COME2oGN.js → pieDiagram-E7YTZNPT-C_wIgDJM.js} +1 -1
- package/dist/{process-output-DNxpsd4n.js → process-output-Deae7dX1.js} +4 -4
- package/dist/{railroadDiagram-O6MQD6OU-CUeFcNTY.js → railroadDiagram-O6MQD6OU-CwoJvnvC.js} +2 -2
- package/dist/{requirementDiagram-BXWQKSXE-BUR4lDZG.js → requirementDiagram-BXWQKSXE-C8JuhLLL.js} +1 -1
- package/dist/{reveal-component-BM9TozVQ.js → reveal-component-VR4UzAUv.js} +37 -37
- package/dist/{select-Ca-POp4c.js → select-DW32QOzC.js} +4 -4
- package/dist/{sequenceDiagram-WJ2MYXX4-CSPmml3q.js → sequenceDiagram-WJ2MYXX4-RbrRdoiV.js} +1 -1
- package/dist/{spec-BgSMwzks.js → spec-Ww0JjShW.js} +4 -4
- package/dist/{stateDiagram-D77RDMKH-BDUC8Pi9.js → stateDiagram-D77RDMKH-DWdIvCnU.js} +2 -2
- package/dist/{stateDiagram-v2-MP3YSRHH-BH-qyk8a.js → stateDiagram-v2-MP3YSRHH-BG0j9crW.js} +2 -2
- package/dist/{static-state-Cqzv5X7B.js → static-state-CnQdTBTW.js} +1 -1
- package/dist/style.css +1 -1
- package/dist/{swimlanes-42K2YHIH-CLE9Kiir.js → swimlanes-42K2YHIH-B6zUw4gq.js} +1 -1
- package/dist/{swimlanesDiagram-VR7AAH4N-Cv8kWAeA.js → swimlanesDiagram-VR7AAH4N-DjVEnsIG.js} +2 -2
- package/dist/{timeline-definition-24CTP7MA-fbRGX21i.js → timeline-definition-24CTP7MA-DSAxwqnC.js} +1 -1
- package/dist/{toast-0xspcdmv.js → toast-Crofa36R.js} +3 -3
- package/dist/{tooltip-BwlFTaNy.js → tooltip-Bg-SDCwa.js} +1 -1
- package/dist/{use-restore-focus-fKgXR0nb.js → use-restore-focus-CE9Sflmg.js} +1298 -1283
- package/dist/{useDateFormatter-B7LvPmsw.js → useDateFormatter-D5fsC9ot.js} +2 -2
- package/dist/{useDeepCompareMemoize-OhBYt-q2.js → useDeepCompareMemoize-Bvrue1iy.js} +1 -1
- package/dist/{useLifecycle-D9xcFAIN.js → useLifecycle-Ctr5lECo.js} +1 -1
- package/dist/{vega-component-Chak9Aon.js → vega-component-DQZhTzVQ.js} +6 -6
- package/dist/{vennDiagram-4TSXK5OY-BzKtg8gL.js → vennDiagram-4TSXK5OY-FAGYRdBj.js} +1 -1
- package/dist/{wardleyDiagram-VM6X3IG4-R0SgDvz1.js → wardleyDiagram-VM6X3IG4-BlB973r1.js} +1 -1
- package/dist/{xychartDiagram-S5SC5T6Z-DRskTHEM.js → xychartDiagram-S5SC5T6Z-CywvmjIK.js} +1 -1
- package/package.json +2 -2
- package/src/__mocks__/executions.ts +48 -8
- package/src/__mocks__/notebook.ts +20 -42
- package/src/components/app-config/__tests__/add-model-discovery.test.tsx +255 -0
- package/src/components/app-config/__tests__/model-discovery.test.tsx +183 -0
- package/src/components/app-config/ai-config.tsx +20 -24
- package/src/components/app-config/model-discovery.tsx +118 -184
- package/src/components/app-config/model-provider-config.ts +25 -0
- package/src/components/editor/Output.tsx +5 -4
- package/src/components/editor/__tests__/data-attributes.test.tsx +1 -6
- package/src/components/editor/__tests__/dynamic-favicon.test.tsx +11 -16
- package/src/components/editor/__tests__/output-persistence.test.tsx +6 -24
- package/src/components/editor/actions/__tests__/useSetOutputsExpanded.test.ts +6 -8
- package/src/components/editor/actions/useSetOutputsExpanded.ts +12 -4
- package/src/components/editor/cell/cell-context-menu.tsx +3 -2
- package/src/components/editor/errors/__tests__/send-error-report-button.test.tsx +89 -72
- package/src/components/editor/notebook-cell.tsx +15 -10
- package/src/components/editor/output/console/process-output.ts +4 -2
- package/src/components/editor/renderers/cells-renderer.tsx +3 -1
- package/src/components/editor/renderers/grid-layout/__tests__/grid-layout.test.tsx +5 -11
- package/src/components/editor/renderers/grid-layout/grid-layout.tsx +9 -8
- package/src/components/editor/renderers/types.ts +2 -2
- package/src/components/editor/renderers/vertical-layout/utils.ts +4 -4
- package/src/components/editor/renderers/vertical-layout/vertical-layout.tsx +5 -8
- package/src/components/scratchpad/scratchpad.tsx +6 -2
- package/src/components/slides/__tests__/cell-output-block.test.tsx +7 -8
- package/src/components/slides/__tests__/minimap-actions.test.tsx +3 -3
- package/src/components/slides/__tests__/slide-cell-view.test.tsx +1 -0
- package/src/components/slides/slide-cell-view.tsx +1 -3
- package/src/components/slides/slide.tsx +3 -3
- package/src/core/ai/context/__tests__/registry.test.ts +7 -11
- package/src/core/ai/context/providers/__tests__/cell-output.test.ts +113 -35
- package/src/core/ai/context/providers/__tests__/error.test.ts +74 -191
- package/src/core/ai/context/providers/cell-output.ts +11 -6
- package/src/core/cells/__tests__/__snapshots__/cells.test.ts.snap +8 -103
- package/src/core/cells/__tests__/cells.test.ts +40 -292
- package/src/core/cells/__tests__/clear-outputs.test.ts +151 -0
- package/src/core/cells/__tests__/harness.ts +14 -12
- package/src/core/cells/__tests__/layout.test.ts +20 -26
- package/src/core/cells/__tests__/notebook-outline.test.ts +49 -43
- package/src/core/cells/__tests__/session.test.ts +26 -146
- package/src/core/cells/actions.ts +49 -9
- package/src/core/cells/cell.ts +0 -13
- package/src/core/cells/cells.ts +53 -62
- package/src/core/cells/focus.ts +6 -1
- package/src/core/cells/layout.ts +2 -3
- package/src/core/cells/outputs.ts +2 -2
- package/src/core/cells/session.ts +3 -38
- package/src/core/cells/types.ts +6 -8
- package/src/core/cells/utils.ts +4 -3
- package/src/core/codemirror/ai/__tests__/resources.test.ts +7 -11
- package/src/core/config/config-schema.ts +15 -0
- package/src/core/errors/__tests__/error-entries.test.ts +52 -18
- package/src/core/errors/error-entries.ts +21 -11
- package/src/core/executions/__tests__/freshness.test.ts +7 -4
- package/src/core/executions/__tests__/hooks.test.tsx +5 -1
- package/src/core/executions/__tests__/interrupt.test.ts +2 -0
- package/src/core/executions/__tests__/output-lifecycle.test.ts +201 -0
- package/src/core/executions/__tests__/output.test.ts +87 -3
- package/src/core/executions/__tests__/select.test.ts +17 -10
- package/src/core/executions/atoms.ts +73 -15
- package/src/core/executions/freshness.ts +1 -1
- package/src/core/executions/hooks.ts +18 -8
- package/src/core/executions/index.ts +6 -0
- package/src/core/executions/output.ts +122 -38
- package/src/core/executions/select.ts +2 -2
- package/src/core/export/__tests__/hooks.test.ts +20 -29
- package/src/core/export/hooks.ts +7 -9
- package/src/core/islands/__tests__/iframe-resizer.test.ts +91 -0
- package/src/core/islands/__tests__/main.test.ts +17 -0
- package/src/core/islands/components/__tests__/web-components.test.tsx +13 -15
- package/src/core/islands/components/output-wrapper.tsx +15 -20
- package/src/core/islands/iframe-resizer.ts +38 -0
- package/src/core/islands/main.ts +3 -0
- package/src/core/lifecycle/render-policy.ts +7 -4
- package/src/core/network/__tests__/ai.test.ts +41 -0
- package/src/core/network/ai.ts +12 -0
- package/src/core/notebook/document/__tests__/codemirror.test.ts +2 -0
- package/src/core/notebook/replica/__tests__/replica.test.ts +19 -0
- package/src/core/notebook/replica/__tests__/results.test.ts +45 -16
- package/src/core/notebook/replica/index.ts +1 -1
- package/src/core/notebook/replica/replica.ts +19 -4
- package/src/core/notebook/replica/resources/executions.ts +100 -9
- package/src/core/notebook/replica/resources/results.ts +46 -31
- package/src/core/transports/__tests__/static.test.ts +5 -3
- package/src/stories/cell.stories.tsx +40 -30
- package/src/stories/layout/vertical/one-column.stories.tsx +15 -7
- package/dist/assets/__vite-browser-external-C5NhJPNJ.js +0 -1
- package/dist/assets/worker-D-n8vtGi.js +0 -171
- package/dist/duckdb-keywords-BGArYVVK.js +0 -3
|
@@ -123,7 +123,7 @@ describe("cell reducer", () => {
|
|
|
123
123
|
state.cellHandles[cid] = { current: handle };
|
|
124
124
|
}
|
|
125
125
|
}
|
|
126
|
-
cells = flattenTopLevelNotebookCells(state);
|
|
126
|
+
cells = flattenTopLevelNotebookCells(state, new Map());
|
|
127
127
|
};
|
|
128
128
|
const actions = createActions((action) => {
|
|
129
129
|
state = reducer(state, action);
|
|
@@ -272,7 +272,6 @@ describe("cell reducer", () => {
|
|
|
272
272
|
timestamp: 2,
|
|
273
273
|
});
|
|
274
274
|
const runtime = state.cellRuntime[firstCellId];
|
|
275
|
-
expect(runtime.output).toEqual(output);
|
|
276
275
|
expect(runtime.consoleOutputs[0].code).toBe(code);
|
|
277
276
|
expect(runtime.consoleOutputs[0].data).toContain("old failure");
|
|
278
277
|
});
|
|
@@ -379,7 +378,6 @@ describe("cell reducer", () => {
|
|
|
379
378
|
cellId: firstCellId,
|
|
380
379
|
});
|
|
381
380
|
cell = cells[0];
|
|
382
|
-
expect(cell.output).not.toBe(null); // keep old output
|
|
383
381
|
// Queue
|
|
384
382
|
actions.handleCellMessage({
|
|
385
383
|
cell_id: firstCellId,
|
|
@@ -389,7 +387,6 @@ describe("cell reducer", () => {
|
|
|
389
387
|
timestamp: new Date(40).getTime() as Seconds,
|
|
390
388
|
});
|
|
391
389
|
cell = cells[0];
|
|
392
|
-
expect(cell.output).not.toBe(null); // keep old output
|
|
393
390
|
// Running
|
|
394
391
|
actions.handleCellMessage({
|
|
395
392
|
cell_id: firstCellId,
|
|
@@ -399,7 +396,6 @@ describe("cell reducer", () => {
|
|
|
399
396
|
timestamp: new Date(50).getTime() as Seconds,
|
|
400
397
|
});
|
|
401
398
|
cell = cells[0];
|
|
402
|
-
expect(cell.output).not.toBe(null); // keep old output
|
|
403
399
|
// Receive error
|
|
404
400
|
actions.handleCellMessage({
|
|
405
401
|
cell_id: firstCellId,
|
|
@@ -416,7 +412,6 @@ describe("cell reducer", () => {
|
|
|
416
412
|
timestamp: new Date(61).getTime() as Seconds,
|
|
417
413
|
});
|
|
418
414
|
cell = cells[0];
|
|
419
|
-
expect(cell.output).not.toBe(null); // keep old output
|
|
420
415
|
expect(cell).toMatchSnapshot("error response received");
|
|
421
416
|
|
|
422
417
|
// INTERRUPT RESPONSE
|
|
@@ -426,7 +421,6 @@ describe("cell reducer", () => {
|
|
|
426
421
|
cellId: firstCellId,
|
|
427
422
|
});
|
|
428
423
|
cell = cells[0];
|
|
429
|
-
expect(cell.output).not.toBe(null); // keep old output
|
|
430
424
|
// Queue
|
|
431
425
|
actions.handleCellMessage({
|
|
432
426
|
cell_id: firstCellId,
|
|
@@ -436,7 +430,6 @@ describe("cell reducer", () => {
|
|
|
436
430
|
timestamp: new Date(40).getTime() as Seconds,
|
|
437
431
|
});
|
|
438
432
|
cell = cells[0];
|
|
439
|
-
expect(cell.output).not.toBe(null); // keep old output
|
|
440
433
|
// Running
|
|
441
434
|
actions.handleCellMessage({
|
|
442
435
|
cell_id: firstCellId,
|
|
@@ -446,7 +439,6 @@ describe("cell reducer", () => {
|
|
|
446
439
|
timestamp: new Date(50).getTime() as Seconds,
|
|
447
440
|
});
|
|
448
441
|
cell = cells[0];
|
|
449
|
-
expect(cell.output).not.toBe(null); // keep old output
|
|
450
442
|
// Receive error
|
|
451
443
|
actions.handleCellMessage({
|
|
452
444
|
cell_id: firstCellId,
|
|
@@ -555,10 +547,6 @@ describe("cell reducer", () => {
|
|
|
555
547
|
timestamp: new Date(20).getTime() as Seconds,
|
|
556
548
|
});
|
|
557
549
|
cell = cells[0];
|
|
558
|
-
// oxlint-disable-next-line typescript/no-explicit-any no-unsafe-optional-chaining
|
|
559
|
-
expect((cell.output?.data as any)[0].msg).toBe(
|
|
560
|
-
"This cell wasn't run because an ancestor was stopped with `mo.stop`: ",
|
|
561
|
-
);
|
|
562
550
|
expect(cell).toMatchSnapshot("ancestor stopped");
|
|
563
551
|
|
|
564
552
|
// Receive queued message
|
|
@@ -581,7 +569,6 @@ describe("cell reducer", () => {
|
|
|
581
569
|
timestamp: new Date(40).getTime() as Seconds,
|
|
582
570
|
});
|
|
583
571
|
cell = cells[0];
|
|
584
|
-
expect(cell.output).toBe(null);
|
|
585
572
|
expect(cell).toMatchSnapshot("running after stop");
|
|
586
573
|
});
|
|
587
574
|
|
|
@@ -920,40 +907,6 @@ describe("cell reducer", () => {
|
|
|
920
907
|
`);
|
|
921
908
|
});
|
|
922
909
|
|
|
923
|
-
it("can clear output of a single cell", () => {
|
|
924
|
-
// Set up initial state with output
|
|
925
|
-
actions.handleCellMessage({
|
|
926
|
-
cell_id: firstCellId,
|
|
927
|
-
output: {
|
|
928
|
-
channel: "output",
|
|
929
|
-
mimetype: "text/plain",
|
|
930
|
-
data: "test output",
|
|
931
|
-
timestamp: 0,
|
|
932
|
-
},
|
|
933
|
-
console: {
|
|
934
|
-
channel: "stdout",
|
|
935
|
-
mimetype: "text/plain",
|
|
936
|
-
data: "console output",
|
|
937
|
-
timestamp: 0,
|
|
938
|
-
},
|
|
939
|
-
status: "idle",
|
|
940
|
-
timestamp: new Date(33).getTime() as Seconds,
|
|
941
|
-
});
|
|
942
|
-
|
|
943
|
-
// Verify initial state has output
|
|
944
|
-
let cell = cells[0];
|
|
945
|
-
expect(cell.output).not.toBeNull();
|
|
946
|
-
expect(cell.consoleOutputs.length).toBe(1);
|
|
947
|
-
|
|
948
|
-
// Clear output
|
|
949
|
-
actions.clearCellOutput({ cellId: firstCellId });
|
|
950
|
-
|
|
951
|
-
// Verify output is cleared
|
|
952
|
-
cell = cells[0];
|
|
953
|
-
expect(cell.output).toBeNull();
|
|
954
|
-
expect(cell.consoleOutputs).toEqual([]);
|
|
955
|
-
});
|
|
956
|
-
|
|
957
910
|
it("can clear console output of a single cell", () => {
|
|
958
911
|
// Set up initial state with output
|
|
959
912
|
actions.handleCellMessage({
|
|
@@ -987,9 +940,8 @@ describe("cell reducer", () => {
|
|
|
987
940
|
timestamp: new Date(34).getTime() as Seconds,
|
|
988
941
|
});
|
|
989
942
|
|
|
990
|
-
// Verify initial state has
|
|
943
|
+
// Verify initial state has console outputs
|
|
991
944
|
let cell = cells[0];
|
|
992
|
-
expect(cell.output).not.toBeNull();
|
|
993
945
|
expect(cell.consoleOutputs.length).toBe(2);
|
|
994
946
|
|
|
995
947
|
// Clear console output
|
|
@@ -997,90 +949,11 @@ describe("cell reducer", () => {
|
|
|
997
949
|
|
|
998
950
|
// Verify only console output is cleared, but stdin is preserved
|
|
999
951
|
cell = cells[0];
|
|
1000
|
-
expect(cell.output).not.toBeNull(); // Output should remain
|
|
1001
952
|
expect(cell.consoleOutputs.length).toBe(1);
|
|
1002
953
|
expect(cell.consoleOutputs[0].channel).toBe("stdin");
|
|
1003
954
|
expect(cell.consoleOutputs[0].data).toBe("stdin prompt");
|
|
1004
955
|
});
|
|
1005
956
|
|
|
1006
|
-
it("can clear output of all cells", () => {
|
|
1007
|
-
// Create multiple cells with output
|
|
1008
|
-
seedCell({ cellId: firstCellId, before: false });
|
|
1009
|
-
const secondCellId = state.cellIds[1];
|
|
1010
|
-
|
|
1011
|
-
// Add output to both cells
|
|
1012
|
-
const outputMessage = {
|
|
1013
|
-
output: {
|
|
1014
|
-
channel: "output",
|
|
1015
|
-
mimetype: "text/plain",
|
|
1016
|
-
data: "test output",
|
|
1017
|
-
timestamp: 0,
|
|
1018
|
-
},
|
|
1019
|
-
console: {
|
|
1020
|
-
channel: "stdout",
|
|
1021
|
-
mimetype: "text/plain",
|
|
1022
|
-
data: "console output",
|
|
1023
|
-
timestamp: 0,
|
|
1024
|
-
},
|
|
1025
|
-
status: "idle",
|
|
1026
|
-
timestamp: new Date(33).getTime() as Seconds,
|
|
1027
|
-
} as const;
|
|
1028
|
-
|
|
1029
|
-
actions.handleCellMessage({
|
|
1030
|
-
...outputMessage,
|
|
1031
|
-
cell_id: firstCellId,
|
|
1032
|
-
});
|
|
1033
|
-
actions.handleCellMessage({
|
|
1034
|
-
...outputMessage,
|
|
1035
|
-
cell_id: secondCellId,
|
|
1036
|
-
});
|
|
1037
|
-
|
|
1038
|
-
// Verify initial state has output
|
|
1039
|
-
expect(state.cellRuntime[firstCellId].output).not.toBeNull();
|
|
1040
|
-
expect(state.cellRuntime[firstCellId].consoleOutputs.length).toBe(1);
|
|
1041
|
-
expect(state.cellRuntime[secondCellId].output).not.toBeNull();
|
|
1042
|
-
expect(state.cellRuntime[secondCellId].consoleOutputs.length).toBe(1);
|
|
1043
|
-
|
|
1044
|
-
// Clear all outputs
|
|
1045
|
-
actions.clearAllCellOutputs();
|
|
1046
|
-
|
|
1047
|
-
// Verify all outputs are cleared
|
|
1048
|
-
expect(state.cellRuntime[firstCellId].output).toBeNull();
|
|
1049
|
-
expect(state.cellRuntime[firstCellId].consoleOutputs).toEqual([]);
|
|
1050
|
-
expect(state.cellRuntime[secondCellId].output).toBeNull();
|
|
1051
|
-
expect(state.cellRuntime[secondCellId].consoleOutputs).toEqual([]);
|
|
1052
|
-
});
|
|
1053
|
-
|
|
1054
|
-
it("can clear all outputs", () => {
|
|
1055
|
-
// Add a cell and give it output
|
|
1056
|
-
seedCell({
|
|
1057
|
-
cellId: firstCellId,
|
|
1058
|
-
before: false,
|
|
1059
|
-
});
|
|
1060
|
-
|
|
1061
|
-
const cell1Id = cells[0].id;
|
|
1062
|
-
const cell2Id = cells[1].id;
|
|
1063
|
-
|
|
1064
|
-
// Manually set output for the cells
|
|
1065
|
-
state.cellRuntime[cell1Id].output = {
|
|
1066
|
-
channel: "output",
|
|
1067
|
-
mimetype: "text/plain",
|
|
1068
|
-
data: "output1",
|
|
1069
|
-
timestamp: 0 as Seconds,
|
|
1070
|
-
};
|
|
1071
|
-
state.cellRuntime[cell2Id].output = {
|
|
1072
|
-
channel: "output",
|
|
1073
|
-
mimetype: "text/plain",
|
|
1074
|
-
data: "output2",
|
|
1075
|
-
timestamp: 0 as Seconds,
|
|
1076
|
-
};
|
|
1077
|
-
|
|
1078
|
-
actions.clearAllCellOutputs();
|
|
1079
|
-
|
|
1080
|
-
expect(state.cellRuntime[cell1Id].output).toBeNull();
|
|
1081
|
-
expect(state.cellRuntime[cell2Id].output).toBeNull();
|
|
1082
|
-
});
|
|
1083
|
-
|
|
1084
957
|
describe("releaseCellAtoms", () => {
|
|
1085
958
|
it("atom families cache atoms until explicitly removed", () => {
|
|
1086
959
|
const { cellDataAtom, cellRuntimeAtom, cellHandleAtom } =
|
|
@@ -1130,162 +1003,60 @@ describe("createTracebackInfoAtom", () => {
|
|
|
1130
1003
|
expect(traceback).toBeUndefined();
|
|
1131
1004
|
});
|
|
1132
1005
|
|
|
1133
|
-
it("extracts
|
|
1134
|
-
store.set(
|
|
1135
|
-
notebookAtom,
|
|
1136
|
-
MockNotebook.notebookState({
|
|
1137
|
-
cellData: {
|
|
1138
|
-
[cellId("cell1")]: {
|
|
1139
|
-
id: cellId("cell1"),
|
|
1140
|
-
name: "cell1",
|
|
1141
|
-
code: "x = 1",
|
|
1142
|
-
},
|
|
1143
|
-
},
|
|
1144
|
-
cellRuntime: {
|
|
1145
|
-
[cellId("cell1")]: {
|
|
1146
|
-
output: {
|
|
1147
|
-
channel: "marimo-error",
|
|
1148
|
-
data: [{ type: "syntax", msg: "Syntax error", lineno: 5 }],
|
|
1149
|
-
mimetype: "application/vnd.marimo+error",
|
|
1150
|
-
},
|
|
1151
|
-
},
|
|
1152
|
-
},
|
|
1153
|
-
}),
|
|
1154
|
-
);
|
|
1155
|
-
|
|
1156
|
-
const tracebackAtom = exportedForTesting.createTracebackInfoAtom(
|
|
1157
|
-
cellId("cell1"),
|
|
1158
|
-
);
|
|
1159
|
-
const traceback = store.get(tracebackAtom);
|
|
1160
|
-
|
|
1161
|
-
expect(traceback).toBeDefined();
|
|
1162
|
-
expect(traceback).toHaveLength(1);
|
|
1163
|
-
expect(traceback![0]).toEqual({
|
|
1164
|
-
kind: "cell",
|
|
1165
|
-
cellId: cellId("cell1"),
|
|
1166
|
-
lineNumber: 5,
|
|
1167
|
-
});
|
|
1168
|
-
});
|
|
1169
|
-
|
|
1170
|
-
it("handles syntax errors with lineno = 0", async () => {
|
|
1006
|
+
it("extracts the line of a syntax error the host reports", () => {
|
|
1171
1007
|
store.set(
|
|
1172
1008
|
notebookAtom,
|
|
1173
1009
|
MockNotebook.notebookState({
|
|
1174
|
-
cellData: {
|
|
1175
|
-
[cellId("cell1")]: {
|
|
1176
|
-
id: cellId("cell1"),
|
|
1177
|
-
name: "cell1",
|
|
1178
|
-
code: "x = 1",
|
|
1179
|
-
},
|
|
1180
|
-
},
|
|
1181
|
-
cellRuntime: {
|
|
1182
|
-
[cellId("cell1")]: {
|
|
1183
|
-
output: {
|
|
1184
|
-
channel: "marimo-error",
|
|
1185
|
-
data: [{ type: "syntax", msg: "Syntax error", lineno: 0 }],
|
|
1186
|
-
mimetype: "application/vnd.marimo+error",
|
|
1187
|
-
},
|
|
1188
|
-
},
|
|
1189
|
-
},
|
|
1010
|
+
cellData: { [cellId("cell1")]: { code: "x = 1" } },
|
|
1190
1011
|
}),
|
|
1191
1012
|
);
|
|
1192
|
-
|
|
1193
|
-
|
|
1194
|
-
|
|
1195
|
-
|
|
1196
|
-
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
expect(traceback![0].lineNumber).toBe(0);
|
|
1200
|
-
});
|
|
1201
|
-
|
|
1202
|
-
it("ignores syntax errors with lineno = null", () => {
|
|
1203
|
-
store.set(
|
|
1204
|
-
notebookAtom,
|
|
1205
|
-
MockNotebook.notebookState({
|
|
1206
|
-
cellData: {
|
|
1207
|
-
[cellId("cell1")]: {
|
|
1208
|
-
id: cellId("cell1"),
|
|
1209
|
-
name: "cell1",
|
|
1210
|
-
code: "x = 1",
|
|
1211
|
-
},
|
|
1212
|
-
},
|
|
1213
|
-
cellRuntime: {
|
|
1214
|
-
[cellId("cell1")]: {
|
|
1215
|
-
output: {
|
|
1216
|
-
channel: "marimo-error",
|
|
1217
|
-
data: [{ type: "syntax", msg: "Syntax error", lineno: null }],
|
|
1218
|
-
mimetype: "application/vnd.marimo+error",
|
|
1219
|
-
},
|
|
1220
|
-
},
|
|
1013
|
+
MockExecutions.seed(store, [
|
|
1014
|
+
MockExecutions.failed(cellId("cell1"), {
|
|
1015
|
+
kind: "invalid-syntax",
|
|
1016
|
+
message: "Syntax error",
|
|
1017
|
+
range: {
|
|
1018
|
+
start: { line: 4, character: 0 },
|
|
1019
|
+
end: { line: 4, character: 0 },
|
|
1221
1020
|
},
|
|
1222
1021
|
}),
|
|
1223
|
-
);
|
|
1022
|
+
]);
|
|
1224
1023
|
|
|
1225
1024
|
const tracebackAtom = exportedForTesting.createTracebackInfoAtom(
|
|
1226
1025
|
cellId("cell1"),
|
|
1227
1026
|
);
|
|
1228
1027
|
const traceback = store.get(tracebackAtom);
|
|
1229
1028
|
|
|
1230
|
-
expect(traceback).
|
|
1029
|
+
expect(traceback).toEqual([
|
|
1030
|
+
{ kind: "cell", cellId: cellId("cell1"), lineNumber: 5 },
|
|
1031
|
+
]);
|
|
1231
1032
|
});
|
|
1232
1033
|
|
|
1233
|
-
it("
|
|
1034
|
+
it("ignores a syntax error without a range", () => {
|
|
1234
1035
|
store.set(
|
|
1235
1036
|
notebookAtom,
|
|
1236
1037
|
MockNotebook.notebookState({
|
|
1237
|
-
cellData: {
|
|
1238
|
-
[cellId("cell1")]: {
|
|
1239
|
-
id: cellId("cell1"),
|
|
1240
|
-
name: "cell1",
|
|
1241
|
-
code: "x = 1",
|
|
1242
|
-
},
|
|
1243
|
-
},
|
|
1244
|
-
cellRuntime: {
|
|
1245
|
-
[cellId("cell1")]: {
|
|
1246
|
-
output: {
|
|
1247
|
-
channel: "marimo-error",
|
|
1248
|
-
data: [
|
|
1249
|
-
{ type: "syntax", msg: "Syntax error", lineno: 3 },
|
|
1250
|
-
{ type: "syntax", msg: "Syntax error", lineno: 7 },
|
|
1251
|
-
],
|
|
1252
|
-
mimetype: "application/vnd.marimo+error",
|
|
1253
|
-
},
|
|
1254
|
-
},
|
|
1255
|
-
},
|
|
1038
|
+
cellData: { [cellId("cell1")]: { code: "x = 1" } },
|
|
1256
1039
|
}),
|
|
1257
1040
|
);
|
|
1041
|
+
MockExecutions.seed(store, [
|
|
1042
|
+
MockExecutions.failed(cellId("cell1"), {
|
|
1043
|
+
kind: "invalid-syntax",
|
|
1044
|
+
message: "Syntax error",
|
|
1045
|
+
}),
|
|
1046
|
+
]);
|
|
1258
1047
|
|
|
1259
1048
|
const tracebackAtom = exportedForTesting.createTracebackInfoAtom(
|
|
1260
1049
|
cellId("cell1"),
|
|
1261
1050
|
);
|
|
1262
|
-
|
|
1263
|
-
expect(
|
|
1264
|
-
expect(traceback).toHaveLength(2);
|
|
1265
|
-
expect(traceback![0].lineNumber).toBe(3);
|
|
1266
|
-
expect(traceback![1].lineNumber).toBe(7);
|
|
1051
|
+
|
|
1052
|
+
expect(store.get(tracebackAtom)).toBeUndefined();
|
|
1267
1053
|
});
|
|
1268
1054
|
|
|
1269
1055
|
it("returns undefined when cell is queued", async () => {
|
|
1270
1056
|
store.set(
|
|
1271
1057
|
notebookAtom,
|
|
1272
1058
|
MockNotebook.notebookState({
|
|
1273
|
-
cellData: {
|
|
1274
|
-
[cellId("cell1")]: {
|
|
1275
|
-
id: cellId("cell1"),
|
|
1276
|
-
name: "cell1",
|
|
1277
|
-
code: "x = 1",
|
|
1278
|
-
},
|
|
1279
|
-
},
|
|
1280
|
-
cellRuntime: {
|
|
1281
|
-
[cellId("cell1")]: {
|
|
1282
|
-
output: {
|
|
1283
|
-
channel: "marimo-error",
|
|
1284
|
-
data: [{ type: "syntax", msg: "Syntax error", lineno: 1 }],
|
|
1285
|
-
mimetype: "application/vnd.marimo+error",
|
|
1286
|
-
},
|
|
1287
|
-
},
|
|
1288
|
-
},
|
|
1059
|
+
cellData: { [cellId("cell1")]: { code: "x = 1" } },
|
|
1289
1060
|
}),
|
|
1290
1061
|
);
|
|
1291
1062
|
MockExecutions.seed(store, [MockExecutions.queued(cellId("cell1"))]);
|
|
@@ -1302,22 +1073,7 @@ describe("createTracebackInfoAtom", () => {
|
|
|
1302
1073
|
store.set(
|
|
1303
1074
|
notebookAtom,
|
|
1304
1075
|
MockNotebook.notebookState({
|
|
1305
|
-
cellData: {
|
|
1306
|
-
[cellId("cell1")]: {
|
|
1307
|
-
id: cellId("cell1"),
|
|
1308
|
-
name: "cell1",
|
|
1309
|
-
code: "x = 1",
|
|
1310
|
-
},
|
|
1311
|
-
},
|
|
1312
|
-
cellRuntime: {
|
|
1313
|
-
[cellId("cell1")]: {
|
|
1314
|
-
output: {
|
|
1315
|
-
channel: "marimo-error",
|
|
1316
|
-
data: [{ type: "syntax", msg: "Syntax error", lineno: 1 }],
|
|
1317
|
-
mimetype: "application/vnd.marimo+error",
|
|
1318
|
-
},
|
|
1319
|
-
},
|
|
1320
|
-
},
|
|
1076
|
+
cellData: { [cellId("cell1")]: { code: "x = 1" } },
|
|
1321
1077
|
}),
|
|
1322
1078
|
);
|
|
1323
1079
|
MockExecutions.seed(store, [MockExecutions.running(cellId("cell1"))]);
|
|
@@ -1342,14 +1098,7 @@ describe("kernel-ready", () => {
|
|
|
1342
1098
|
[CELL_B]: { id: CELL_B, code: "2" },
|
|
1343
1099
|
},
|
|
1344
1100
|
cellRuntime: {
|
|
1345
|
-
[CELL_A]: {
|
|
1346
|
-
output: {
|
|
1347
|
-
channel: "output",
|
|
1348
|
-
mimetype: "text/plain",
|
|
1349
|
-
data: "hydrated-A",
|
|
1350
|
-
timestamp: 0,
|
|
1351
|
-
},
|
|
1352
|
-
},
|
|
1101
|
+
[CELL_A]: { debuggerActive: true },
|
|
1353
1102
|
[CELL_B]: {
|
|
1354
1103
|
consoleOutputs: [
|
|
1355
1104
|
{
|
|
@@ -1369,7 +1118,7 @@ describe("kernel-ready", () => {
|
|
|
1369
1118
|
payload: undefined,
|
|
1370
1119
|
});
|
|
1371
1120
|
|
|
1372
|
-
expect(next.cellRuntime[CELL_A].
|
|
1121
|
+
expect(next.cellRuntime[CELL_A].debuggerActive).toBe(false);
|
|
1373
1122
|
expect(next.cellRuntime[CELL_B].consoleOutputs).toEqual([]);
|
|
1374
1123
|
});
|
|
1375
1124
|
|
|
@@ -1378,12 +1127,14 @@ describe("kernel-ready", () => {
|
|
|
1378
1127
|
cellData: { [CELL_A]: { id: CELL_A, code: "1" } },
|
|
1379
1128
|
cellRuntime: {
|
|
1380
1129
|
[SCRATCH_CELL_ID]: {
|
|
1381
|
-
|
|
1382
|
-
|
|
1383
|
-
|
|
1384
|
-
|
|
1385
|
-
|
|
1386
|
-
|
|
1130
|
+
consoleOutputs: [
|
|
1131
|
+
{
|
|
1132
|
+
channel: "stdout",
|
|
1133
|
+
mimetype: "text/plain",
|
|
1134
|
+
data: "scratch",
|
|
1135
|
+
timestamp: 0,
|
|
1136
|
+
},
|
|
1137
|
+
],
|
|
1387
1138
|
},
|
|
1388
1139
|
},
|
|
1389
1140
|
});
|
|
@@ -1392,7 +1143,7 @@ describe("kernel-ready", () => {
|
|
|
1392
1143
|
payload: undefined,
|
|
1393
1144
|
});
|
|
1394
1145
|
|
|
1395
|
-
expect(next.cellRuntime[SCRATCH_CELL_ID].
|
|
1146
|
+
expect(next.cellRuntime[SCRATCH_CELL_ID].consoleOutputs).toEqual([]);
|
|
1396
1147
|
});
|
|
1397
1148
|
|
|
1398
1149
|
describe("resetCellRuntimes in WASM", () => {
|
|
@@ -1406,15 +1157,13 @@ describe("kernel-ready", () => {
|
|
|
1406
1157
|
vi.mocked(isWasm).mockReturnValue(false);
|
|
1407
1158
|
});
|
|
1408
1159
|
|
|
1409
|
-
it("keeps hydrated
|
|
1160
|
+
it("keeps hydrated console output and starts the rest over", () => {
|
|
1410
1161
|
const next = exportedForTesting.reducer(hydratedState(), {
|
|
1411
1162
|
type: "resetCellRuntimes",
|
|
1412
1163
|
payload: undefined,
|
|
1413
1164
|
});
|
|
1414
1165
|
|
|
1415
|
-
expect(next.cellRuntime[CELL_A].
|
|
1416
|
-
data: "hydrated-A",
|
|
1417
|
-
});
|
|
1166
|
+
expect(next.cellRuntime[CELL_A].debuggerActive).toBe(false);
|
|
1418
1167
|
expect(next.cellRuntime[CELL_B].consoleOutputs[0]).toMatchObject({
|
|
1419
1168
|
data: "hydrated-B-stdout",
|
|
1420
1169
|
});
|
|
@@ -1429,7 +1178,6 @@ describe("kernel-ready", () => {
|
|
|
1429
1178
|
payload: undefined,
|
|
1430
1179
|
});
|
|
1431
1180
|
|
|
1432
|
-
expect(next.cellRuntime[CELL_A].output).toBeNull();
|
|
1433
1181
|
expect(next.cellRuntime[CELL_A].consoleOutputs).toEqual([]);
|
|
1434
1182
|
});
|
|
1435
1183
|
});
|
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
/* Copyright 2026 Marimo. All rights reserved. */
|
|
2
|
+
|
|
3
|
+
import { createStore } from "jotai";
|
|
4
|
+
import { describe, expect, it } from "vitest";
|
|
5
|
+
import { MockExecutions } from "@/__mocks__/executions";
|
|
6
|
+
import { MockNotebook } from "@/__mocks__/notebook";
|
|
7
|
+
import { cellId } from "@/__tests__/branded";
|
|
8
|
+
import { cellOutputAtom } from "@/core/executions";
|
|
9
|
+
import {
|
|
10
|
+
cell,
|
|
11
|
+
document,
|
|
12
|
+
withCells,
|
|
13
|
+
} from "@/core/notebook/document/__tests__/fixtures";
|
|
14
|
+
import { executions } from "@/core/notebook/replica/resources/executions";
|
|
15
|
+
import { clearAllCellOutputsAtom, clearCellOutputAtom } from "../actions";
|
|
16
|
+
import { notebookAtom } from "../cells";
|
|
17
|
+
import type { ConsoleOutputMessage } from "../types";
|
|
18
|
+
|
|
19
|
+
const A = cellId("a");
|
|
20
|
+
const B = cellId("b");
|
|
21
|
+
const DOCUMENT = withCells(document(), {
|
|
22
|
+
c1: null,
|
|
23
|
+
c2: null,
|
|
24
|
+
[A]: cell(A, ""),
|
|
25
|
+
[B]: cell(B, ""),
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
const STDOUT: ConsoleOutputMessage = {
|
|
29
|
+
channel: "stdout",
|
|
30
|
+
mimetype: "text/plain",
|
|
31
|
+
data: "printed",
|
|
32
|
+
timestamp: 0,
|
|
33
|
+
id: 1,
|
|
34
|
+
};
|
|
35
|
+
const PROMPT: ConsoleOutputMessage = {
|
|
36
|
+
channel: "stdin",
|
|
37
|
+
mimetype: "text/plain",
|
|
38
|
+
data: "name?",
|
|
39
|
+
timestamp: 0,
|
|
40
|
+
id: 2,
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
function setup() {
|
|
44
|
+
const store = createStore();
|
|
45
|
+
store.set(
|
|
46
|
+
notebookAtom,
|
|
47
|
+
MockNotebook.notebookState({
|
|
48
|
+
cellData: { [A]: {}, [B]: {} },
|
|
49
|
+
cellRuntime: {
|
|
50
|
+
[A]: { consoleOutputs: [STDOUT, PROMPT] },
|
|
51
|
+
[B]: { consoleOutputs: [STDOUT] },
|
|
52
|
+
},
|
|
53
|
+
}),
|
|
54
|
+
);
|
|
55
|
+
MockExecutions.seed(
|
|
56
|
+
store,
|
|
57
|
+
[
|
|
58
|
+
MockExecutions.shown(A, { mimetype: "text/plain", data: "a" }),
|
|
59
|
+
MockExecutions.shown(B, { mimetype: "text/plain", data: "b" }),
|
|
60
|
+
],
|
|
61
|
+
null,
|
|
62
|
+
DOCUMENT,
|
|
63
|
+
);
|
|
64
|
+
return store;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
describe("clearCellOutputAtom", () => {
|
|
68
|
+
it("hides the host's output and the console, keeping an unanswered prompt", () => {
|
|
69
|
+
const store = setup();
|
|
70
|
+
store.set(clearCellOutputAtom, { cellId: A });
|
|
71
|
+
|
|
72
|
+
expect(store.get(cellOutputAtom(A))).toBeNull();
|
|
73
|
+
expect(store.get(notebookAtom).cellRuntime[A].consoleOutputs).toEqual([
|
|
74
|
+
PROMPT,
|
|
75
|
+
]);
|
|
76
|
+
expect(store.get(cellOutputAtom(B))?.data).toBe("b");
|
|
77
|
+
expect(store.get(notebookAtom).cellRuntime[B].consoleOutputs).toEqual([
|
|
78
|
+
STDOUT,
|
|
79
|
+
]);
|
|
80
|
+
});
|
|
81
|
+
});
|
|
82
|
+
|
|
83
|
+
describe("clearing a running cell", () => {
|
|
84
|
+
it("hides what it shows until it shows something new", () => {
|
|
85
|
+
const store = createStore();
|
|
86
|
+
store.set(
|
|
87
|
+
notebookAtom,
|
|
88
|
+
MockNotebook.notebookState({ cellData: { [A]: {} } }),
|
|
89
|
+
);
|
|
90
|
+
const running = MockExecutions.shown(
|
|
91
|
+
A,
|
|
92
|
+
{ mimetype: "text/plain", data: "so far" },
|
|
93
|
+
{ status: "running", completed_at: null },
|
|
94
|
+
);
|
|
95
|
+
const replica = MockExecutions.seed(store, [running], null, DOCUMENT);
|
|
96
|
+
store.set(clearCellOutputAtom, { cellId: A });
|
|
97
|
+
expect(store.get(cellOutputAtom(A))).toBeNull();
|
|
98
|
+
|
|
99
|
+
store.set(replica.executionsAtom, (state) =>
|
|
100
|
+
executions.on.execution!(
|
|
101
|
+
state,
|
|
102
|
+
{
|
|
103
|
+
event: "execution",
|
|
104
|
+
id: "more",
|
|
105
|
+
data: {
|
|
106
|
+
execution: {
|
|
107
|
+
...running,
|
|
108
|
+
outcome: {
|
|
109
|
+
kind: "value",
|
|
110
|
+
display: { mimetype: "text/plain", data: "more" },
|
|
111
|
+
},
|
|
112
|
+
},
|
|
113
|
+
},
|
|
114
|
+
},
|
|
115
|
+
{ phase: "live" },
|
|
116
|
+
),
|
|
117
|
+
);
|
|
118
|
+
expect(store.get(cellOutputAtom(A))?.data).toBe("more");
|
|
119
|
+
|
|
120
|
+
store.set(replica.executionsAtom, (state) =>
|
|
121
|
+
executions.on.execution!(
|
|
122
|
+
state,
|
|
123
|
+
{
|
|
124
|
+
event: "execution",
|
|
125
|
+
id: "again",
|
|
126
|
+
data: { execution: { ...running, outcome: running.outcome } },
|
|
127
|
+
},
|
|
128
|
+
{ phase: "live" },
|
|
129
|
+
),
|
|
130
|
+
);
|
|
131
|
+
expect(store.get(cellOutputAtom(A))?.data).toBe("so far");
|
|
132
|
+
});
|
|
133
|
+
});
|
|
134
|
+
|
|
135
|
+
describe("clearAllCellOutputsAtom", () => {
|
|
136
|
+
it("clears every cell", () => {
|
|
137
|
+
const store = setup();
|
|
138
|
+
const before = store.get(notebookAtom);
|
|
139
|
+
Object.freeze(before.cellRuntime);
|
|
140
|
+
Object.values(before.cellRuntime).forEach(Object.freeze);
|
|
141
|
+
store.set(clearAllCellOutputsAtom);
|
|
142
|
+
|
|
143
|
+
expect(store.get(cellOutputAtom(A))).toBeNull();
|
|
144
|
+
expect(store.get(cellOutputAtom(B))).toBeNull();
|
|
145
|
+
const { cellRuntime } = store.get(notebookAtom);
|
|
146
|
+
expect(cellRuntime[A].consoleOutputs).toEqual([PROMPT]);
|
|
147
|
+
expect(cellRuntime[B].consoleOutputs).toEqual([]);
|
|
148
|
+
expect(before.cellRuntime[A].consoleOutputs).toEqual([STDOUT, PROMPT]);
|
|
149
|
+
expect(before.cellRuntime[B].consoleOutputs).toEqual([STDOUT]);
|
|
150
|
+
});
|
|
151
|
+
});
|