fix(audit M1): Update-/Move-Warnung nur für Inhalte, die vorher zur Schleifen-Kette passten (kein Alarm für ACF-Optionen); Tests für Update und Kettenwarnung beim Move
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Sonnet 5.5
parent
bb5487082e
commit
3a89b15b59
@@ -480,4 +480,54 @@ final class DiviLoopWriteTest extends DiviWriteAbilityTestCase
|
||||
self::assertStringContainsString($right, self::problems($updated));
|
||||
self::assertSame([], $this->saved);
|
||||
}
|
||||
|
||||
private function usePage(string $content): void
|
||||
{
|
||||
$this->original = $content;
|
||||
$this->post->post_content = $content;
|
||||
}
|
||||
|
||||
/** Re-review: content that never fitted its loop (ACF repeater options) is no reason for a warning on an update. */
|
||||
public function testUpdatingALoopContainerDoesNotWarnForContentThatNeverFitted(): void
|
||||
{
|
||||
$acf = VariableRef::serialize('content', 'loop_acf_name', ['before' => '', 'after' => '']);
|
||||
$text = self::block('text', ['content' => ['innerContent' => ['desktop' => ['value' => $acf]]]]);
|
||||
$repeater = ['enable' => 'on', 'queryType' => 'repeater_team'];
|
||||
$this->usePage('<!-- wp:divi/placeholder -->' . self::block('section', self::loop($repeater), self::block(
|
||||
'row',
|
||||
[],
|
||||
self::block('column', [], $text)
|
||||
)) . '<!-- /wp:divi/placeholder -->');
|
||||
|
||||
$result = $this->changeAll([[
|
||||
'id' => 's0',
|
||||
'attrs' => ['module.decoration.background' => ['desktop' => ['color' => '#ff0000']]],
|
||||
]]);
|
||||
|
||||
self::assertTrue($result['ok'], (string) json_encode($result));
|
||||
self::assertStringNotContainsString('Schleife', implode(' | ', $result['warnings']));
|
||||
}
|
||||
|
||||
/** Re-review (M1): a moved loop with a post meta key option takes the outer term loop into its chain – warned. */
|
||||
public function testMovingALoopWithMetaKeyContentUnderAnotherKindOfLoopWarns(): void
|
||||
{
|
||||
$meta = VariableRef::serialize(
|
||||
'content',
|
||||
'loop_post_meta_key_manual_custom_field',
|
||||
['before' => '', 'after' => '']
|
||||
);
|
||||
$own = self::block('text', self::loop(self::POST_LOOP) + [
|
||||
'content' => ['innerContent' => ['desktop' => ['value' => $meta]]],
|
||||
]);
|
||||
$termColumn = self::block('column', self::loop(self::TERM_LOOP), self::text('y'));
|
||||
$this->usePage('<!-- wp:divi/placeholder -->' . self::block('section', [], self::block('row', [], implode('', [
|
||||
self::block('column', [], $own),
|
||||
$termColumn,
|
||||
]))) . '<!-- /wp:divi/placeholder -->');
|
||||
|
||||
$result = $this->moveNode(['id' => 's0.r0.c0.m0', 'parent' => 's0.r0.c1']);
|
||||
|
||||
self::assertTrue($result['ok'], (string) json_encode($result));
|
||||
self::assertStringContainsString('loop_post_meta_key_manual_custom_field', implode(' | ', $result['warnings']));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user