Raise loaded documents to the schema their blocks need, and bring the old browser checks back

The kant-it.de header used the hamburger switch at schema 19, so the server refused its
preview and save; the editor now raises a loaded document to the version its blocks and
properties require. The admin, button and navigation checks select blocks through the
structure tab, find the motion button by id and expect what the site's motion setting says.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
kantarciandClaude Opus 5 committed 2026-09-22 12:21:35 +02:00
1 parent 82a74277cb
commit ace6c50743
7 files changed
+87 -9

No files matched your search

+15
View File
@@ -642,3 +642,18 @@ test('registered plugin blocks get labels, defaults, container rules and presets
assert.equal(pluginDefinition(bild), null);
assert.equal(isContainer(galerie), false);
});
test('a loaded document is raised to the schema its blocks and properties need', async () => {
const { repairSchema } = await import('../public/assets/editor-model.js');
// So stand der Kopfbereich von kant-it.de da: Hamburger-Umschaltung bei Fassung 19.
const header = { schemaVersion: 19, title: 'Kopf', description: '', blocks: [
{ id: 's', type: 'section', anchor: 'oben', children: [{ id: 'm', type: 'menu', props: { slot: 'header', collapse: 'tablet' } }] },
] };
assert.equal(repairSchema(header).schemaVersion, 22);
// Nichts Neues darin: die Fassung bleibt - auch die Umstellung auf formatierten Text (12)
// kommt nie von allein.
const plain = { schemaVersion: 5, title: 'Alt', description: '', blocks: [{ id: 't', type: 'text', props: { text: 'a < b' } }] };
assert.equal(repairSchema(plain).schemaVersion, 5);
const faq = { schemaVersion: 10, title: 'F', description: '', blocks: [{ id: 'a', type: 'accordion', props: { faq: true }, children: [] }] };
assert.equal(repairSchema(faq).schemaVersion, 23);
});