feat: design-system filters and global module ids in node-get/outline (S19)
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:
@@ -5,6 +5,7 @@ declare(strict_types=1);
|
||||
namespace LIT\MCP\Tests\Unit\Integrations\Divi\Design;
|
||||
|
||||
use Brain\Monkey\Functions;
|
||||
use LIT\MCP\Integrations\Divi\Design\DesignSystem;
|
||||
use LIT\MCP\Integrations\Divi\Design\DesignSystemReader;
|
||||
use LIT\MCP\Integrations\Divi\Design\DiviDesignSystemAbility;
|
||||
use LIT\MCP\Tests\Support\DiviFixtures;
|
||||
@@ -41,4 +42,38 @@ final class DiviDesignSystemAbilityTest extends TestCase
|
||||
|
||||
self::assertToolError($result, 'forbidden');
|
||||
}
|
||||
|
||||
public function testFiltersPartsAndPresetsOfOneModule(): void
|
||||
{
|
||||
Functions\when('current_user_can')->justReturn(true);
|
||||
$reader = Mockery::mock(DesignSystemReader::class);
|
||||
$reader->allows('read')->andReturn(DiviFixtures::designSystem());
|
||||
$ability = new DiviDesignSystemAbility($reader);
|
||||
|
||||
$result = $ability->execute(['only' => ['presets'], 'module' => 'button']);
|
||||
|
||||
self::assertSame([], $result['colors']);
|
||||
self::assertSame([], $result['variables']);
|
||||
self::assertSame(['p-1', 'p-2'], array_column($result['presets'], 'id'));
|
||||
self::assertSame(['divi/button'], array_values(array_unique(array_column($result['presets'], 'module'))));
|
||||
self::assertNotEmpty($result['fonts']['heading']);
|
||||
self::assertContains('Nicht angefordert: colors, variables.', $result['notes']);
|
||||
}
|
||||
|
||||
public function testCapsThePresetList(): void
|
||||
{
|
||||
Functions\when('current_user_can')->justReturn(true);
|
||||
$items = [];
|
||||
for ($i = 0; $i < 250; ++$i) {
|
||||
$items['p' . $i] = ['id' => 'p' . $i, 'name' => 'Preset ' . $i, 'moduleName' => 'divi/text'];
|
||||
}
|
||||
$design = DesignSystem::fromDivi([], [], ['module' => ['divi/text' => ['default' => '', 'items' => $items]]], []);
|
||||
$reader = Mockery::mock(DesignSystemReader::class);
|
||||
$reader->allows('read')->andReturn($design);
|
||||
|
||||
$result = (new DiviDesignSystemAbility($reader))->execute([]);
|
||||
|
||||
self::assertCount(DiviDesignSystemAbility::PRESET_LIMIT, $result['presets']);
|
||||
self::assertContains('200 von 250 Presets gezeigt; mit module auf ein Modul eingrenzen.', $result['notes']);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user