feat: global instance in the builder's format, deglobalize, library content rules
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -6,6 +6,7 @@ namespace LIT\MCP\Tests\Unit\Integrations\Divi\Compose;
|
||||
|
||||
use LIT\MCP\Integrations\Divi\BlockTree\Block;
|
||||
use LIT\MCP\Integrations\Divi\BlockTree\Document;
|
||||
use LIT\MCP\Integrations\Divi\BlockTree\GlobalInstance;
|
||||
use LIT\MCP\Integrations\Divi\BlockTree\NodeIndex;
|
||||
use LIT\MCP\Integrations\Divi\BlockTree\Parser;
|
||||
use LIT\MCP\Integrations\Divi\BlockTree\Serializer;
|
||||
@@ -201,4 +202,22 @@ final class TreeEditorTest extends TestCase
|
||||
self::assertStringContainsString('Spezialabschnitte', (string) $editor->insert($editor->position($index, ['parent' => 's0']), [Block::create('divi/row')]));
|
||||
self::assertNull($editor->insert($editor->position($index, ['parent' => 's0.c0']), [$text]));
|
||||
}
|
||||
|
||||
/** A global instance counts as its root type: a section instance at the top, a module instance in a column. */
|
||||
public function testGlobalInstancesFollowTheRulesOfTheirRootType(): void
|
||||
{
|
||||
$document = $this->document('stage3/page--globale-instanzen.html');
|
||||
$index = NodeIndex::build($document);
|
||||
$editor = new TreeEditor(ComposeFixture::rules());
|
||||
|
||||
self::assertNull($editor->move($index, $index->find('g0'), $editor->position($index, ['after' => 's1'])));
|
||||
|
||||
$index = NodeIndex::build($document);
|
||||
$module = GlobalInstance::of(Block::create('divi/text'), 1059);
|
||||
self::assertNull($editor->insert($editor->position($index, ['parent' => 's1.r0.c0']), [$module]));
|
||||
self::assertSame(
|
||||
'auf oberster Ebene sind nur Abschnitte (section) erlaubt',
|
||||
$editor->insert($editor->position($index, []), [GlobalInstance::of(Block::create('divi/text'), 1059)])
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user