feat: lit-divi-update prüft jede Änderung im Schleifen-Kontext ihres Knotens – ein Composer je Kontext, neue loop-Attribute zählen (X3, S31)
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Sonnet 5.5
parent
249bc7b932
commit
8888d246a9
@@ -172,4 +172,53 @@ final class DiviLoopWriteTest extends DiviWriteAbilityTestCase
|
||||
]]);
|
||||
self::assertTrue($withoutLoopContent['ok'], (string) json_encode($withoutLoopContent));
|
||||
}
|
||||
|
||||
/** Ruling X3: one Composer per loop scope – changes in a post loop and a term loop in one call. */
|
||||
public function testUpdateChecksEveryChangeInItsOwnLoop(): void
|
||||
{
|
||||
$result = $this->changeAll([
|
||||
['id' => 's0.r0.c0.m1', 'set' => ['content' => '{{loop:post_date}}']],
|
||||
['id' => 's0.r0.c1.m0', 'set' => ['content' => '{{loop:term_name}}']],
|
||||
['id' => 's0.r0.c2.m0', 'set' => ['content' => '<p>Neu</p>']],
|
||||
]);
|
||||
|
||||
self::assertTrue($result['ok'], (string) json_encode($result));
|
||||
self::assertStringContainsString('loop_term_name', $this->saved[0]);
|
||||
|
||||
$refused = $this->changeAll([
|
||||
['id' => 's0.r0.c0.m1', 'set' => ['content' => '{{loop:term_name}}']],
|
||||
['id' => 's0.r0.c2.m0', 'set' => ['content' => '{{loop:post_date}}']],
|
||||
]);
|
||||
$problems = self::errorFields($refused);
|
||||
self::assertStringContainsString('Typ: Beiträge', $problems['changes[0].set.content'] ?? '');
|
||||
self::assertStringContainsString('braucht eine Divi-Schleife', $problems['changes[1].set.content'] ?? '');
|
||||
}
|
||||
|
||||
/**
|
||||
* Ruling X3: the scope of a change takes the loop attrs this call gives the node or an ancestor – a loop
|
||||
* switched on admits its content, a loop switched to another kind refuses the old kind's content.
|
||||
*/
|
||||
public function testUpdateUsesTheLoopsThisCallSets(): void
|
||||
{
|
||||
$switchedOn = $this->changeAll([
|
||||
['id' => 's0.r0.c2', 'attrs' => ['module.advanced.loop' => ['desktop' => self::TERM_LOOP]]],
|
||||
['id' => 's0.r0.c2.m0', 'set' => ['content' => '{{loop:term_name}}']],
|
||||
]);
|
||||
self::assertTrue($switchedOn['ok'], (string) json_encode($switchedOn));
|
||||
|
||||
$own = $this->changeAll([[
|
||||
'id' => 's0.r0.c0.m1',
|
||||
'attrs' => ['module.advanced.loop' => ['desktop' => self::TERM_LOOP]],
|
||||
'set' => ['content' => '{{loop:term_name}}'],
|
||||
]]);
|
||||
self::assertTrue($own['ok'], (string) json_encode($own));
|
||||
|
||||
$switchedKind = $this->changeAll([
|
||||
['id' => 's0.r0.c0', 'attrs' => ['module.advanced.loop' => ['desktop' => self::TERM_LOOP]]],
|
||||
['id' => 's0.r0.c0.m0', 'set' => ['content' => '{{loop:post_date}}']],
|
||||
]);
|
||||
$problems = self::errorFields($switchedKind);
|
||||
self::assertStringContainsString('Typ: Terme', $problems['changes[1].set.content'] ?? '');
|
||||
self::assertCount(2, $this->saved);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user