fix: lit/divi-presets-assign verweigert leeren Text als Preset (Eingabe und Gruppen); Stapelgrenze und Preset-Schema aus PresetAssignment
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Sonnet 5.5
parent
6b5de199f9
commit
b805ed64dd
@@ -117,6 +117,29 @@ final class DiviPresetsAssignAbilityTest extends TestCase
|
||||
self::assertSame('preset oder group_presets angeben', self::errorFields($missing)['preset']);
|
||||
}
|
||||
|
||||
public function testEmptyStringAssignmentPointsToDetachToo(): void
|
||||
{
|
||||
$ability = $this->ability(self::untouched());
|
||||
|
||||
$empty = $ability->execute(['module' => 'button', 'preset' => '', 'confirm' => true]);
|
||||
self::assertToolError($empty, 'validation_failed');
|
||||
self::assertStringContainsString('lit/divi-design-detach', self::errorFields($empty)['preset']);
|
||||
|
||||
$group = $ability->execute(['module' => 'text', 'group_presets' => ['font-body' => ''], 'confirm' => true]);
|
||||
self::assertToolError($group, 'validation_failed');
|
||||
self::assertStringContainsString(
|
||||
'lit/divi-design-detach',
|
||||
self::errorFields($group)['group_presets.font-body']
|
||||
);
|
||||
}
|
||||
|
||||
public function testInputSchemaForbidsEmptyPresetStrings(): void
|
||||
{
|
||||
$schema = $this->ability(self::untouched())->inputSchema()['properties']['preset'];
|
||||
|
||||
self::assertSame(1, $schema['minLength']);
|
||||
}
|
||||
|
||||
public function testBadModuleFiltersAndPostIdsAreCollected(): void
|
||||
{
|
||||
$ability = $this->ability(self::untouched());
|
||||
@@ -212,7 +235,7 @@ final class DiviPresetsAssignAbilityTest extends TestCase
|
||||
self::assertSame(['readonly' => false, 'destructive' => false, 'idempotent' => true], $ability->annotations());
|
||||
self::assertSame(['module'], $schema['required']);
|
||||
self::assertFalse($schema['additionalProperties']);
|
||||
self::assertSame(DiviPresetsAssignAbility::MAX_STACK, $schema['properties']['preset']['maxItems']);
|
||||
self::assertSame(PresetAssignment::MAX_STACK, $schema['properties']['preset']['maxItems']);
|
||||
self::assertArrayNotHasKey('design_rev', $schema['properties']);
|
||||
self::assertSame(['saved', 'remaining', 'skipped'], array_slice($ability->outputSchema()['required'], -3));
|
||||
self::assertStringContainsString('gewinnt das letzte Preset im Stapel', $ability->description());
|
||||
|
||||
Reference in New Issue
Block a user