feat: lit/divi-insert and lit/divi-update
All-or-nothing at ability level (S39), duplicate ids refused (S14), set and attrs on the same path refused (S38), invalid_attr_path error. 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:
@@ -183,6 +183,26 @@ final class ComposerTest extends TestCase
|
||||
self::assertStringContainsString('nur lesbar', $readOnly['errors']['changes[2].id']);
|
||||
}
|
||||
|
||||
/** Ruling S38: one change may not reach the same attribute path through set and attrs. */
|
||||
public function testUpdateRefusesSetAndAttrsOnTheSamePath(): void
|
||||
{
|
||||
$block = Block::create('divi/button', ['button' => ['innerContent' => ['desktop' => ['value' => ['text' => 'Alt']]]]]);
|
||||
|
||||
$result = ComposeFixture::composer()->update($block, [
|
||||
'set' => ['text' => 'Neu'],
|
||||
'attrs' => ['button.innerContent' => ['desktop' => ['linkUrl' => '/kontakt']]],
|
||||
], 'changes[0]');
|
||||
|
||||
self::assertStringContainsString('set.text', $result['errors']['changes[0].attrs.button.innerContent']);
|
||||
self::assertSame([], $result['invalid_paths']);
|
||||
|
||||
$separate = ComposeFixture::composer()->update($block, [
|
||||
'set' => ['text' => 'Neu'],
|
||||
'attrs' => ['button.decoration.background' => ['desktop' => ['color' => '#ffffff']]],
|
||||
], 'changes[0]');
|
||||
self::assertSame([], $separate['errors'], 'different paths may be combined');
|
||||
}
|
||||
|
||||
/** Ruling S13: labels go through the choke point; a label that fails is an error, never stored raw. */
|
||||
public function testLabelsAreCleanedOrReported(): void
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user