@marimo-team/islands 0.25.3-dev169 → 0.25.3-dev170

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.
Files changed (123) hide show
  1. package/dist/{ConnectedDataExplorerComponent-BbDrlHvG.js → ConnectedDataExplorerComponent-BbSXV-Xa.js} +8 -8
  2. package/dist/{ErrorBoundary-RaIwGWT3.js → ErrorBoundary-NE86qEWZ.js} +4 -4
  3. package/dist/{abnfDiagram-VCTEODGH-Dr-fo8_z.js → abnfDiagram-VCTEODGH-D7n07nXf.js} +2 -2
  4. package/dist/{architectureDiagram-5GKGNRK7-ByKIl9GG.js → architectureDiagram-5GKGNRK7-D6CjRib5.js} +1 -1
  5. package/dist/{chat-ui-BsV2WH-4.js → chat-ui-CC7GekpG.js} +34 -34
  6. package/dist/{chunk-IMKFNOWR-IKDP18MQ.js → chunk-IMKFNOWR-6dtPz7uS.js} +1 -1
  7. package/dist/{chunk-SHT3W25Y-LkIgegwh.js → chunk-SHT3W25Y-BwnFNKDA.js} +1 -1
  8. package/dist/{chunk-SVP7TREG-DReBYtnB.js → chunk-SVP7TREG-D2eV4vBJ.js} +1 -1
  9. package/dist/{chunk-TICWLB2K-DQ0A0-1D.js → chunk-TICWLB2K-BDs4-_-r.js} +1 -1
  10. package/dist/{classDiagram-ZZMXUADV-CwvXdCNE.js → classDiagram-ZZMXUADV-DCJnf_8v.js} +2 -2
  11. package/dist/{classDiagram-v2-VYDZK3BY-D0XAxDsc.js → classDiagram-v2-VYDZK3BY-BOmSzPBD.js} +2 -2
  12. package/dist/{code-visibility-BMi0KLAQ.js → code-visibility-Bzvc6ajl.js} +23 -23
  13. package/dist/{common-BMkJrZsD.js → common-Ciw4zkh2.js} +3412 -3412
  14. package/dist/{cynefinDiagram-5FMLGOSQ-BFN68nHr.js → cynefinDiagram-5FMLGOSQ-Bln_Soky.js} +1 -1
  15. package/dist/{dagre-GXQ25YYZ-CZt4rtLq.js → dagre-GXQ25YYZ-D-nf7WzW.js} +1 -1
  16. package/dist/{data-grid-overlay-editor-CCc1P42P.js → data-grid-overlay-editor-AQREmxI7.js} +1 -1
  17. package/dist/{diagram-S7CK7UJ4-D5cOz47_.js → diagram-S7CK7UJ4-PsgSMkY2.js} +1 -1
  18. package/dist/{diagram-UQ7AKVKN-Qgdppb4a.js → diagram-UQ7AKVKN-DfwfUuSw.js} +1 -1
  19. package/dist/{diagram-VX7I27RA-BsDCvily.js → diagram-VX7I27RA-C9_e-oMc.js} +1 -1
  20. package/dist/{diagram-Z3DM3KII-igTkGjKI.js → diagram-Z3DM3KII-CWLa5tuY.js} +1 -1
  21. package/dist/{dropdown-menu-BWnnAstC.js → dropdown-menu-B6ftyzOg.js} +1 -1
  22. package/dist/{ebnfDiagram-PWID7BFC-BHuZGjIr.js → ebnfDiagram-PWID7BFC-B1QRM58v.js} +2 -2
  23. package/dist/{erDiagram-RLTQ6QDP-DKObXTVE.js → erDiagram-RLTQ6QDP-DJK_FqvW.js} +1 -1
  24. package/dist/{error-entries-BpUJSLUZ.js → error-entries-DgK3wUJR.js} +5640 -5591
  25. package/dist/{feedback-button-CMVkEos_.js → feedback-button-8a6SETmT.js} +24 -24
  26. package/dist/{flowDiagram-HODETNUW-DZI_kit0.js → flowDiagram-HODETNUW-Uxc25XSJ.js} +2 -2
  27. package/dist/{formats-CwJHWasD.js → formats-DQCyPd5Z.js} +1 -1
  28. package/dist/{glide-data-editor-BA2pcHSV.js → glide-data-editor-B70oke_v.js} +5 -5
  29. package/dist/{globals-B5jjJ0ms.js → globals-Cxd5hNlI.js} +2 -2
  30. package/dist/{html-to-image-CQr2-IDA.js → html-to-image-D4yG5Ru0.js} +25 -25
  31. package/dist/{infoDiagram-27XIBGKW-DdPl-7-n.js → infoDiagram-27XIBGKW-DmjxqwL0.js} +1 -1
  32. package/dist/{ishikawaDiagram-5VMMS53U-DbyW6l59.js → ishikawaDiagram-5VMMS53U-NgCLHqQi.js} +1 -1
  33. package/dist/{kanban-definition-UXKFOSKX-BMX9SyBS.js → kanban-definition-UXKFOSKX-CZaG-iam.js} +1 -1
  34. package/dist/main.js +187 -188
  35. package/dist/{mermaid-C8W8mTbA.js → mermaid-CSvw7c71.js} +34 -34
  36. package/dist/{mindmap-definition-YA3MSWOX-Zd_tAxWL.js → mindmap-definition-YA3MSWOX-DJYQBDH_.js} +1 -1
  37. package/dist/{number-overlay-editor-BIWiV-TU.js → number-overlay-editor-ChK-SKUk.js} +1 -1
  38. package/dist/{pegDiagram-XKGWAZYB-DjYydPdo.js → pegDiagram-XKGWAZYB-CHKO_dAe.js} +2 -2
  39. package/dist/{pieDiagram-E7YTZNPT-R5LKjO2n.js → pieDiagram-E7YTZNPT-DVevbMAo.js} +1 -1
  40. package/dist/{process-output-Uw-VJE5V.js → process-output-DxvBAeL3.js} +3 -3
  41. package/dist/{railroadDiagram-O6MQD6OU-C7uNKtfm.js → railroadDiagram-O6MQD6OU-Detj1kcB.js} +2 -2
  42. package/dist/{requirementDiagram-BXWQKSXE-CxAIzQfl.js → requirementDiagram-BXWQKSXE-BLFD0T_Z.js} +1 -1
  43. package/dist/{reveal-component-XiecZ3Ua.js → reveal-component-CXMXeDZD.js} +6 -6
  44. package/dist/{sequenceDiagram-WJ2MYXX4-B5tmlPd5.js → sequenceDiagram-WJ2MYXX4-BZBgatQV.js} +1 -1
  45. package/dist/{spec-45FnujvG.js → spec-Mnkn3XEr.js} +1 -1
  46. package/dist/{stateDiagram-D77RDMKH-C1hc5H7Y.js → stateDiagram-D77RDMKH-4BZW9-6_.js} +2 -2
  47. package/dist/{stateDiagram-v2-MP3YSRHH-DRWeqQTn.js → stateDiagram-v2-MP3YSRHH-C4sKC8Iq.js} +2 -2
  48. package/dist/style.css +1 -1
  49. package/dist/{swimlanes-42K2YHIH-NTLas--s.js → swimlanes-42K2YHIH-SL5yeGe2.js} +1 -1
  50. package/dist/{swimlanesDiagram-VR7AAH4N-ChPggljD.js → swimlanesDiagram-VR7AAH4N-DqPmAYUv.js} +2 -2
  51. package/dist/{timeline-definition-24CTP7MA-B4CZ9srJ.js → timeline-definition-24CTP7MA-BfXUMWkq.js} +1 -1
  52. package/dist/{toDate-rySyYxqk.js → toDate-TMubKIVL.js} +22 -22
  53. package/dist/{useAsyncData-B7MiltyV.js → useAsyncData-DjMGFzFy.js} +1 -1
  54. package/dist/{useDeepCompareMemoize-DZmHBD_1.js → useDeepCompareMemoize-BQR5TJot.js} +1 -1
  55. package/dist/{useLifecycle-DRbRhzxg.js → useLifecycle-C_GvKWbQ.js} +26 -23
  56. package/dist/{useTheme-TLkqJsvo.js → useTheme-Bns2gJZ6.js} +179 -178
  57. package/dist/{vega-component-DC6P127L.js → vega-component-BsVptuhz.js} +5 -5
  58. package/dist/{vennDiagram-4TSXK5OY-DJIvMt44.js → vennDiagram-4TSXK5OY-CH65znGa.js} +1 -1
  59. package/dist/{wardleyDiagram-VM6X3IG4-45H0zg0u.js → wardleyDiagram-VM6X3IG4-z9pWKb2_.js} +1 -1
  60. package/dist/{xychartDiagram-S5SC5T6Z-ZT-XzcPN.js → xychartDiagram-S5SC5T6Z-MxyaWjjq.js} +1 -1
  61. package/package.json +1 -1
  62. package/src/__mocks__/requests.ts +0 -1
  63. package/src/components/editor/cell/StagedAICell.tsx +10 -2
  64. package/src/components/editor/cell/code/cell-editor.tsx +7 -14
  65. package/src/components/editor/chrome/wrapper/__tests__/document-sync-status.test.tsx +92 -0
  66. package/src/components/editor/chrome/wrapper/footer-items/document-sync-status.tsx +54 -0
  67. package/src/components/editor/chrome/wrapper/footer.tsx +2 -0
  68. package/src/core/ai/__tests__/staged-cells.test.ts +8 -5
  69. package/src/core/ai/staged-cells.ts +7 -2
  70. package/src/core/ai/tools/__tests__/edit-notebook-tool.test.ts +3 -15
  71. package/src/core/ai/tools/edit-notebook-tool.ts +14 -3
  72. package/src/core/cells/__tests__/cells.test.ts +0 -297
  73. package/src/core/cells/__tests__/document.test.ts +410 -0
  74. package/src/core/cells/__tests__/flush-document.test.ts +40 -0
  75. package/src/core/cells/__tests__/notebook-outline.test.ts +1 -6
  76. package/src/core/cells/__tests__/with-document-save.test.ts +67 -0
  77. package/src/core/cells/cells.ts +27 -158
  78. package/src/core/cells/columns.ts +38 -0
  79. package/src/core/cells/document.ts +360 -0
  80. package/src/core/cells/types.ts +12 -0
  81. package/src/core/codemirror/cells/__tests__/extensions.test.ts +27 -1
  82. package/src/core/codemirror/cells/extensions.ts +14 -0
  83. package/src/core/codemirror/format.ts +6 -5
  84. package/src/core/codemirror/language/__tests__/utils.test.ts +187 -15
  85. package/src/core/codemirror/language/cell-code.ts +114 -0
  86. package/src/core/codemirror/language/extension.ts +47 -30
  87. package/src/core/codemirror/language/languages/sql/sql.ts +7 -17
  88. package/src/core/codemirror/language/utils.ts +9 -39
  89. package/src/core/codemirror/lsp/notebook-lsp.ts +6 -5
  90. package/src/core/codemirror/rtc/extension.ts +0 -1
  91. package/src/core/edit-app.tsx +4 -3
  92. package/src/core/export/layout.ts +2 -2
  93. package/src/core/islands/bridge.ts +0 -1
  94. package/src/core/network/requests-lazy.ts +0 -1
  95. package/src/core/network/requests-network.ts +0 -9
  96. package/src/core/network/requests-static.ts +0 -1
  97. package/src/core/network/requests-toasting.tsx +0 -1
  98. package/src/core/network/types.ts +0 -5
  99. package/src/core/notebook/document/__tests__/codemirror.test.ts +76 -14
  100. package/src/core/notebook/document/__tests__/hold.test.ts +88 -0
  101. package/src/core/notebook/document/__tests__/hooks.test.tsx +3 -3
  102. package/src/core/notebook/document/__tests__/lifecycle-scenarios.test.ts +3 -3
  103. package/src/core/notebook/document/__tests__/model.test.ts +71 -15
  104. package/src/core/notebook/document/__tests__/scenario-fixture.ts +1 -1
  105. package/src/core/notebook/document/codemirror.ts +27 -122
  106. package/src/core/notebook/document/hooks.tsx +2 -2
  107. package/src/core/notebook/document/index.ts +9 -1
  108. package/src/core/notebook/document/model.ts +74 -24
  109. package/src/core/notebook/document/sync.ts +53 -4
  110. package/src/core/run-app.tsx +44 -41
  111. package/src/core/saving/save-component.tsx +2 -5
  112. package/src/core/session/__tests__/useNotebookSession.hook.test.tsx +63 -3
  113. package/src/core/session/active-notebook.ts +4 -0
  114. package/src/core/session/useNotebookSession.tsx +39 -19
  115. package/src/core/wasm/__tests__/bridge.test.ts +3 -3
  116. package/src/core/wasm/bridge.ts +5 -12
  117. package/src/core/wasm/worker/worker.ts +0 -9
  118. package/src/utils/__tests__/{createReducer.test.ts → createReducer.test.tsx} +28 -0
  119. package/src/utils/createReducer.ts +42 -21
  120. package/src/core/cells/__tests__/apply-transaction.test.ts +0 -991
  121. package/src/core/cells/__tests__/document-changes.test.ts +0 -1140
  122. package/src/core/cells/__tests__/document-roundtrip.test.ts +0 -392
  123. package/src/core/cells/document-changes.ts +0 -944
@@ -1,392 +0,0 @@
1
- /* Copyright 2026 Marimo. All rights reserved. */
2
-
3
- /**
4
- * Round-trip tests: perform actions on a primary notebook (producing changes
5
- * via the middleware), then apply those changes to a replica notebook via
6
- * applyTransactionChanges. The two should converge to identical document state.
7
- *
8
- * This catches drift between what the middleware emits and what
9
- * apply-transaction consumes.
10
- */
11
-
12
- import { python } from "@codemirror/lang-python";
13
- import { EditorState } from "@codemirror/state";
14
- import { EditorView } from "@codemirror/view";
15
- import {
16
- afterAll,
17
- afterEach,
18
- beforeAll,
19
- beforeEach,
20
- describe,
21
- expect,
22
- it,
23
- } from "vitest";
24
- import { cellId } from "@/__tests__/branded";
25
- import type { CellHandle } from "@/components/editor/notebook-cell";
26
- import { adaptiveLanguageConfiguration } from "@/core/codemirror/language/extension";
27
- import { OverridingHotkeyProvider } from "@/core/hotkeys/hotkeys";
28
- import { MultiColumn } from "@/utils/id-tree";
29
- import { exportedForTesting, type NotebookState } from "../cells";
30
- import {
31
- applyTransactionChanges,
32
- exportedForTesting as middlewareExports,
33
- } from "../document-changes";
34
- import { CellId } from "../ids";
35
-
36
- const { initialNotebookState, reducer, createActions } = exportedForTesting;
37
- const { drainChanges } = middlewareExports;
38
-
39
- function createEditor(code: string) {
40
- const state = EditorState.create({
41
- doc: code,
42
- extensions: [
43
- python(),
44
- adaptiveLanguageConfiguration({
45
- cellId: cellId("cell1"),
46
- completionConfig: {
47
- activate_on_typing: true,
48
- signature_hint_on_typing: false,
49
- copilot: false,
50
- codeium_api_key: null,
51
- },
52
- hotkeys: new OverridingHotkeyProvider({}),
53
- placeholderType: "marimo-import",
54
- lspConfig: {},
55
- }),
56
- ],
57
- });
58
- return new EditorView({ state, parent: document.body });
59
- }
60
-
61
- // --- Primary notebook: performs actions, middleware produces changes ---
62
-
63
- let primary: NotebookState;
64
-
65
- const primaryActions = createActions((action) => {
66
- primary = reducer(primary, action);
67
- for (const [cellIdString, handle] of Object.entries(primary.cellHandles)) {
68
- // @ts-expect-error - Object.entries doesn't know keys are CellId
69
- const cid: CellId = cellIdString;
70
- if (!handle.current) {
71
- const view = createEditor(primary.cellData[cid].code);
72
- const h: CellHandle = { editorView: view, editorViewOrNull: view };
73
- primary.cellHandles[cid] = { current: h };
74
- }
75
- }
76
- });
77
-
78
- // --- Replica notebook: receives changes via applyTransactionChanges ---
79
-
80
- let replica: NotebookState;
81
-
82
- const replicaActions = createActions((action) => {
83
- replica = reducer(replica, action);
84
- for (const [cellIdString, handle] of Object.entries(replica.cellHandles)) {
85
- // @ts-expect-error - Object.entries doesn't know keys are CellId
86
- const cid: CellId = cellIdString;
87
- if (!handle.current) {
88
- const view = createEditor(replica.cellData[cid].code);
89
- const h: CellHandle = { editorView: view, editorViewOrNull: view };
90
- replica.cellHandles[cid] = { current: h };
91
- }
92
- }
93
- });
94
-
95
- let i = 0;
96
- const originalCreate = CellId.create.bind(CellId);
97
-
98
- beforeAll(() => {
99
- CellId.create = () => cellId(`${i++}`);
100
- });
101
-
102
- beforeEach(() => {
103
- i = 0;
104
- primary = initialNotebookState();
105
- primary.cellIds = MultiColumn.from([]);
106
- drainChanges();
107
- });
108
-
109
- afterEach(() => {
110
- middlewareExports.cancelPendingChanges();
111
- });
112
-
113
- afterAll(() => {
114
- CellId.create = originalCreate;
115
- });
116
-
117
- /** Set up both notebooks with the same initial cells. */
118
- function setup(...codes: string[]) {
119
- for (const code of codes) {
120
- primaryActions.createNewCell({
121
- cellId: "__end__",
122
- before: false,
123
- code,
124
- newCellId: CellId.create(),
125
- });
126
- }
127
-
128
- // Apply the setup changes to the replica so both start identical
129
- const setupChanges = drainChanges();
130
- replica = initialNotebookState();
131
- replica.cellIds = MultiColumn.from([]);
132
- applyTransactionChanges(
133
- setupChanges,
134
- replicaActions,
135
- () => replica.cellIds.inOrderIds,
136
- );
137
- // Drain any changes the replica's middleware produced
138
- drainChanges();
139
- }
140
-
141
- /**
142
- * Drain changes from the primary's middleware and apply them to the replica.
143
- */
144
- function sync() {
145
- const changes = drainChanges();
146
- applyTransactionChanges(
147
- changes,
148
- replicaActions,
149
- () => replica.cellIds.inOrderIds,
150
- );
151
- // Drain any changes the replica's middleware produced (we don't want those)
152
- drainChanges();
153
- }
154
-
155
- /**
156
- * Extract the document-relevant state: cell ordering, code, name, config.
157
- * This is the "NotebookDocument" equivalent — what the Python side tracks.
158
- *
159
- * TODO(column-config): config.column is excluded because the column
160
- * reducers (addColumnBreakpoint, dropOverNewColumn, moveColumn, etc.)
161
- * update cellIds (MultiColumn structure) but don't sync config.column
162
- * on affected cells. The middleware correctly emits set-config changes with
163
- * the new column index, but the primary's config.column stays stale,
164
- * causing a mismatch with the replica. Fix: have the column reducers
165
- * update config.column as part of their state transition, then remove
166
- * the { column: _, ...config } exclusion here.
167
- */
168
- function documentSnapshot(state: NotebookState) {
169
- return state.cellIds.inOrderIds.map((id) => {
170
- const { column: _, ...config } = state.cellData[id].config;
171
- return {
172
- id,
173
- code: state.cellData[id].code,
174
- name: state.cellData[id].name,
175
- config,
176
- };
177
- });
178
- }
179
-
180
- describe("document round-trip", () => {
181
- it("applies a server transaction that deletes every cell", () => {
182
- setup("a", "b");
183
- applyTransactionChanges(
184
- [
185
- ...replica.cellIds.inOrderIds.map((cellId) => ({
186
- type: "delete-cell" as const,
187
- cellId,
188
- })),
189
- { type: "reorder-cells", cellIds: [] },
190
- ],
191
- replicaActions,
192
- () => replica.cellIds.inOrderIds,
193
- );
194
- expect(documentSnapshot(replica)).toEqual([]);
195
- });
196
-
197
- it("initial setup converges", () => {
198
- setup("a", "b", "c");
199
- expect(documentSnapshot(primary)).toEqual(documentSnapshot(replica));
200
- });
201
-
202
- it("createNewCell at end", () => {
203
- setup("a", "b");
204
- primaryActions.createNewCell({
205
- cellId: "__end__",
206
- before: false,
207
- code: "c",
208
- newCellId: CellId.create(),
209
- });
210
- sync();
211
- expect(documentSnapshot(primary)).toEqual(documentSnapshot(replica));
212
- });
213
-
214
- it("createNewCell before first cell", () => {
215
- setup("a", "b");
216
- const [a] = primary.cellIds.inOrderIds;
217
- primaryActions.createNewCell({
218
- cellId: a,
219
- before: true,
220
- code: "before-a",
221
- newCellId: CellId.create(),
222
- });
223
- sync();
224
- expect(documentSnapshot(primary)).toEqual(documentSnapshot(replica));
225
- });
226
-
227
- it("createNewCell between cells", () => {
228
- setup("a", "b", "c");
229
- const [a] = primary.cellIds.inOrderIds;
230
- primaryActions.createNewCell({
231
- cellId: a,
232
- before: false,
233
- code: "between",
234
- newCellId: CellId.create(),
235
- });
236
- sync();
237
- expect(documentSnapshot(primary)).toEqual(documentSnapshot(replica));
238
- });
239
-
240
- it("createNewCell with hideCode config", () => {
241
- setup("a");
242
- primaryActions.createNewCell({
243
- cellId: "__end__",
244
- before: false,
245
- code: "hidden",
246
- newCellId: CellId.create(),
247
- hideCode: true,
248
- });
249
- sync();
250
- expect(documentSnapshot(primary)).toEqual(documentSnapshot(replica));
251
- });
252
-
253
- it("deleteCell", () => {
254
- setup("a", "b", "c");
255
- const [, b] = primary.cellIds.inOrderIds;
256
- primaryActions.deleteCell({ cellId: b });
257
- sync();
258
- expect(documentSnapshot(primary)).toEqual(documentSnapshot(replica));
259
- });
260
-
261
- it("updateCellCode", () => {
262
- setup("a", "b");
263
- const [a] = primary.cellIds.inOrderIds;
264
- primaryActions.updateCellCode({
265
- cellId: a,
266
- code: "updated",
267
- formattingChange: false,
268
- });
269
- sync();
270
- expect(documentSnapshot(primary)).toEqual(documentSnapshot(replica));
271
- });
272
-
273
- it("updateCellName", () => {
274
- setup("a");
275
- const [a] = primary.cellIds.inOrderIds;
276
- primaryActions.updateCellName({ cellId: a, name: "my_var" });
277
- sync();
278
- expect(documentSnapshot(primary)).toEqual(documentSnapshot(replica));
279
- });
280
-
281
- it("updateCellConfig", () => {
282
- setup("a");
283
- const [a] = primary.cellIds.inOrderIds;
284
- primaryActions.updateCellConfig({
285
- cellId: a,
286
- config: { hide_code: true, disabled: true },
287
- });
288
- sync();
289
- expect(documentSnapshot(primary)).toEqual(documentSnapshot(replica));
290
- });
291
-
292
- it("moveCell down", () => {
293
- setup("a", "b", "c");
294
- const [a] = primary.cellIds.inOrderIds;
295
- primaryActions.moveCell({ cellId: a, before: false });
296
- sync();
297
- expect(documentSnapshot(primary)).toEqual(documentSnapshot(replica));
298
- });
299
-
300
- it("sendToTop", () => {
301
- setup("a", "b", "c");
302
- const c = primary.cellIds.inOrderIds[2];
303
- primaryActions.sendToTop({ cellId: c });
304
- sync();
305
- expect(documentSnapshot(primary)).toEqual(documentSnapshot(replica));
306
- });
307
-
308
- it("sendToBottom", () => {
309
- setup("a", "b", "c");
310
- const [a] = primary.cellIds.inOrderIds;
311
- primaryActions.sendToBottom({ cellId: a });
312
- sync();
313
- expect(documentSnapshot(primary)).toEqual(documentSnapshot(replica));
314
- });
315
-
316
- it("dropCellOverCell", () => {
317
- setup("a", "b", "c");
318
- const [a, , c] = primary.cellIds.inOrderIds;
319
- primaryActions.dropCellOverCell({ cellId: c, overCellId: a });
320
- sync();
321
- expect(documentSnapshot(primary)).toEqual(documentSnapshot(replica));
322
- });
323
-
324
- it("multiple operations in sequence", () => {
325
- setup("a", "b", "c");
326
-
327
- // Add a cell
328
- const [a] = primary.cellIds.inOrderIds;
329
- primaryActions.createNewCell({
330
- cellId: a,
331
- before: false,
332
- code: "new",
333
- newCellId: CellId.create(),
334
- });
335
- sync();
336
-
337
- // Rename it
338
- const newId = primary.cellIds.inOrderIds[1];
339
- primaryActions.updateCellName({ cellId: newId, name: "inserted" });
340
- sync();
341
-
342
- // Move it to top
343
- primaryActions.sendToTop({ cellId: newId });
344
- sync();
345
-
346
- // Update code on another cell
347
- const last =
348
- primary.cellIds.inOrderIds[primary.cellIds.inOrderIds.length - 1];
349
- primaryActions.updateCellCode({
350
- cellId: last,
351
- code: "modified",
352
- formattingChange: false,
353
- });
354
- sync();
355
-
356
- expect(documentSnapshot(primary)).toEqual(documentSnapshot(replica));
357
- });
358
-
359
- it("create then delete", () => {
360
- setup("a", "b");
361
- primaryActions.createNewCell({
362
- cellId: "__end__",
363
- before: false,
364
- code: "temporary",
365
- newCellId: CellId.create(),
366
- });
367
- sync();
368
-
369
- const newId =
370
- primary.cellIds.inOrderIds[primary.cellIds.inOrderIds.length - 1];
371
- primaryActions.deleteCell({ cellId: newId });
372
- sync();
373
-
374
- expect(documentSnapshot(primary)).toEqual(documentSnapshot(replica));
375
- });
376
-
377
- it("addColumnBreakpoint", () => {
378
- setup("a", "b", "c");
379
- const [, b] = primary.cellIds.inOrderIds;
380
- primaryActions.addColumnBreakpoint({ cellId: b });
381
- sync();
382
- expect(documentSnapshot(primary)).toEqual(documentSnapshot(replica));
383
- });
384
-
385
- it("dropOverNewColumn", () => {
386
- setup("a", "b", "c");
387
- const [, b] = primary.cellIds.inOrderIds;
388
- primaryActions.dropOverNewColumn({ cellId: b });
389
- sync();
390
- expect(documentSnapshot(primary)).toEqual(documentSnapshot(replica));
391
- });
392
- });