Zeige Name, Sprungmarke und Ausgeblendet im Seitenaufbau und biete die Felder am Abschnitt an

Kopierte Abschnitte geben ihre Sprungmarke ab, damit die Seite weiter speicherbar bleibt.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
LarsandClaude Sonnet 5.5 committed 2026-11-27 06:57:38 +01:00
1 parent 3a37e8a7a1
commit ed53bb1669
3 files changed
+131 -6

No files matched your search

+32 -1
View File
@@ -263,10 +263,41 @@ public function test_duplicated_section_is_inserted_right_after_its_original():
$items = ['a' => ['n' => 1], 'b' => ['n' => 2], 'c' => ['n' => 3]];
$this->assertSame(['a', 'b', 'kopie', 'c'], array_keys(SectionEditor::insertCopyAfter($items, 'b', 'kopie')));
$this->assertSame(['n' => 2], SectionEditor::insertCopyAfter($items, 'b', 'kopie')['kopie']);
// Die Kopie hat nie eine Sprungmarke (sie wäre doppelt); ohne Namen bleibt sie ohne Namen.
$this->assertSame(['n' => 2, 'anchor' => null, 'name' => null], SectionEditor::insertCopyAfter($items, 'b', 'kopie')['kopie']);
$this->assertSame($items, SectionEditor::insertCopyAfter($items, 'fehlt', 'kopie'));
}
public function test_a_duplicated_section_gives_up_its_anchor_so_the_page_still_saves(): void
{
$items = ['a' => [
'name' => 'Kurse', 'anchor' => 'kurse', 'hidden' => true, 'layout' => 'u4', 'style' => [],
'slots' => [['widget' => []]],
]];
$copy = SectionEditor::insertCopyAfter($items, 'a', 'b');
$this->assertSame('kurse', $copy['a']['anchor']);
$this->assertNull($copy['b']['anchor']);
$this->assertSame('Kurse (Kopie)', $copy['b']['name']);
$this->assertTrue($copy['b']['hidden']);
// Beide Abschnitte lassen sich gemeinsam speichern.
$saved = $this->sections()->normalize(SectionEditor::fromEditorState($copy));
$this->assertSame(['kurse', null], array_column($saved, 'anchor'));
}
public function test_editor_state_round_trips_name_anchor_and_hidden(): void
{
$stored = $this->sections()->normalize([['name' => 'Kontakt', 'anchor' => 'kontakt', 'hidden' => true, 'layout' => 'u4', 'style' => [], 'slots' => [null]]]);
$state = SectionEditor::toEditorState($this->sections()->read($stored));
$this->assertSame(['Kontakt', 'kontakt', true], [$state[0]['name'], $state[0]['anchor'], $state[0]['hidden']]);
$back = SectionEditor::fromEditorState($state);
$this->assertSame(['Kontakt', 'kontakt', true], [$back[0]['name'], $back[0]['anchor'], $back[0]['hidden']]);
}
public function test_layout_change_in_the_editor_never_drops_a_widget(): void
{
$slots = [