Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions calcit.cirru
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@
:schema $ quote EnumDef
'Store $ %{} 'CodeEntry (:doc |)
:code $ quote $ defstruct Store
:states $ Map Dynamic Dynamic
:states $ Map respo.schema/CoordKey Dynamic
:examples $ []
:schema $ quote StructDef
'decode-store $ %{} 'CodeEntry
Expand Down Expand Up @@ -253,7 +253,7 @@
previous $ app.schema/read-editor-data $ get-state-at states (conj cursor :data)
assoc store :states $ decode-map-as
update-state-tree states cursor $ assoc previous :content content
Map Dynamic Dynamic
Map respo.schema/CoordKey Dynamic
(:hydrate-storage data) data
:examples $ []
:schema $ quote $ Fn app.schema/Store app.schema/Op String Number (-> app.schema/Store)
Expand Down
12 changes: 12 additions & 0 deletions scripts/typed-reel-render.test.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,18 @@ test('content edits survive Reel replay and the existing saved-state format', ()
assert.equal(clt.option_$o_none_$q_(decode_store(clt.parse_cirru_edn('{} (:states $ {} (:cursor |wrong))'))), true);
assert.equal(clt.option_$o_none_$q_(decode_store(clt.parse_cirru_edn(PRE_031_ARCHIVE.replace(':cursor $ []', ':cursor |wrong')))), true);
assert.equal(clt.option_$o_some_$q_(decode_store(clt.parse_cirru_edn('{} (:states $ {})'))), true);
assert.equal(clt.option_$o_some_$q_(decode_store(clt.parse_cirru_edn('{} (:states $ {} (2 ({})) (|panel ({})))'))), true);
assert.equal(clt.option_$o_none_$q_(decode_store(clt.parse_cirru_edn('{} (:states $ {} (true ({})))'))), true);
});

test('updates and restores an editor with string and number cursor keys', () => {
const t = clt.init_tags(['edit-content', 'states', 'data', 'content']);
const edit = clt._PCT__$o__$o_(Op, t['edit-content'], clt._$L_('panel', 2), 'nested');
const updated = updater(store, edit, 'edit', 1);
const restored = clt.option_$o_unwrap(decode_store(clt.parse_cirru_edn(clt.format_cirru_edn(updated))));
const field = (value, key) => clt.option_$o_unwrap(clt.get(value, key));
const editor = field(field(field(field(restored, t.states), 'panel'), 2), t.data);
assert.equal(field(editor, t.content), 'nested');
});

test('hydrates the fixed pre-upgrade archive through the typed Reel update path', () => {
Expand Down