fix: Preset-Änderungen ohne unfiltered_html ablehnen, wenn Divi HTML/CSS anderer Presets entfernen würde

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Jan-Niclas Loosen
2026-10-16 18:09:31 +02:00
co-authored by Claude Opus 5.5
parent 048cd9353d
commit 75714429be
10 changed files with 289 additions and 14 deletions
@@ -42,6 +42,31 @@ final class PresetBookTest extends TestCase
];
}
/** @return array<string, mixed> stored() with HTML in one preset and CSS with ">" in another. */
public static function storedWithMarkup(): array
{
$stored = self::stored();
$stored['module']['divi/button']['items']['bbbbbbbbbb']['attrs'] = [
'module' => ['advanced' => ['html' => ['desktop' => ['value' => ['htmlBefore' => '<b>x</b>']]]]],
];
$stored['group']['divi/font-body']['items']['gggggggggg']['styleAttrs'] = [
'css' => ['desktop' => ['value' => ['freeForm' => 'selector > p { color: red; }']]],
];
return $stored;
}
/** Final review I-2: presets whose HTML/CSS Divi's prepare_data() would strip for editors. */
public function testMarkupOutsideListsUntouchedPresetsWithHtmlOrCss(): void
{
$book = PresetBook::fromDivi(self::storedWithMarkup());
self::assertSame([], PresetBook::fromDivi(self::stored())->markupOutside([]));
self::assertSame(['bbbbbbbbbb', 'gggggggggg'], $book->markupOutside([]));
self::assertSame(['gggggggggg'], $book->markupOutside(['bbbbbbbbbb', 'aaaaaaaaaa']));
self::assertSame([], $book->markupOutside(['bbbbbbbbbb', 'gggggggggg']));
}
public function testFindsByIdOrUniqueName(): void
{
$book = PresetBook::fromDivi(self::stored());