fix: a nested row gets its own auto label (ledger T3)
A row inside a column is labelled "<Abschnitt> – Zeile (innen)" instead of repeating its outer row's "<Abschnitt> – Zeile". Guide updated. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01At3V6SjwbMe6eMzVGW3Hs7
This commit is contained in:
@@ -488,6 +488,29 @@ final class ComposerTest extends TestCase
|
||||
self::assertSame('divi/text', $nested->children()[0]->children()[0]->name());
|
||||
}
|
||||
|
||||
/** Ledger T3: a nested row's auto label differs from its outer row's label. */
|
||||
public function testNestedRowGetsItsOwnAutoLabel(): void
|
||||
{
|
||||
$label = static fn (Block $block): mixed => $block->attrs()['module']['meta']['adminLabel']['desktop']['value'] ?? null;
|
||||
$result = ComposeFixture::composer()->compose([['type' => 'section', 'label' => 'Hero', 'rows' => [[
|
||||
'columns' => '1_2,1_2',
|
||||
'modules' => [[['type' => 'row', 'modules' => [['type' => 'text', 'content' => '<p>a</p>']]]], []],
|
||||
]]]], null, 'nodes');
|
||||
|
||||
self::assertSame([], $result['errors']);
|
||||
$outer = $result['blocks'][0]->children()[0];
|
||||
$nested = $outer->children()[0]->children()[0];
|
||||
self::assertSame('Hero – Zeile', $label($outer));
|
||||
self::assertSame('Hero – Zeile (innen)', $label($nested));
|
||||
self::assertSame('Hero – Text', $label($nested->children()[0]->children()[0]));
|
||||
|
||||
// Inserted straight into an existing column (lit-divi-insert parent = column): nested as well.
|
||||
$inserted = ComposeFixture::composer()->compose([['type' => 'row']], Block::create('divi/column'), 'nodes', 'Hero');
|
||||
self::assertSame('Hero – Zeile (innen)', $label($inserted['blocks'][0]));
|
||||
$intoSection = ComposeFixture::composer()->compose([['type' => 'row']], Block::create('divi/section'), 'nodes', 'Hero');
|
||||
self::assertSame('Hero – Zeile', $label($intoSection['blocks'][0]));
|
||||
}
|
||||
|
||||
public function testRejectsNonObjectsAndMissingTypes(): void
|
||||
{
|
||||
$result = ComposeFixture::composer()->compose(['section', [], ['label' => 'x']], null, 'nodes');
|
||||
|
||||
Reference in New Issue
Block a user