fix: divi-node-get rev + short type, divi-outline id validation
- lit/divi-node-get now also returns the post-level rev (Rev::ofPost, same
optimistic lock lit-content-update needs) next to tree_rev, and reports a
node's type as the short name ("button"), matching lit-divi-outline instead
of the namespaced "divi/button". description() notes that $variable(...)$
values shown are re-validated when written, never taken over unchecked.
- lit/divi-outline validates its optional `id` input against the same
path-ID pattern lit-divi-node-get uses (a malformed id is now a validation
error, not a "not found"), and its outputSchema's per-node `required` list
now includes info/presets/children, which are always present.
- NodeSummary::label() (the admin label shown in outlines and node-get)
whitespace-normalizes and bounds its result via Text::shorten(), like every
other summary string, instead of returning a raw, unbounded value.
- docs/superpowers/notes/.../etappe-2a-abnahme.md corrected: only a global
module is "nur lesbar" - a specialty section is a normal, editable
divi/section block; the outline just marks it "[specialty]".
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -5,6 +5,7 @@ declare(strict_types=1);
|
||||
namespace LIT\MCP\Tests\Unit\Integrations\Divi\BlockTree;
|
||||
|
||||
use LIT\MCP\Integrations\Divi\BlockTree\AttrMap;
|
||||
use LIT\MCP\Integrations\Divi\BlockTree\Block;
|
||||
use LIT\MCP\Integrations\Divi\BlockTree\NodeIndex;
|
||||
use LIT\MCP\Integrations\Divi\BlockTree\NodeSummary;
|
||||
use LIT\MCP\Integrations\Divi\BlockTree\Outline;
|
||||
@@ -69,6 +70,24 @@ final class OutlineTest extends TestCase
|
||||
self::assertSame('', NodeSummary::textOf(new stdClass()));
|
||||
}
|
||||
|
||||
public function testLabelIsWhitespaceNormalizedAndBounded(): void
|
||||
{
|
||||
$block = self::blockWithAdminLabel("Hero \n Titel\twith space");
|
||||
self::assertSame('Hero Titel with space', NodeSummary::label($block));
|
||||
|
||||
$long = str_repeat('a', 200);
|
||||
$shortened = NodeSummary::label(self::blockWithAdminLabel($long));
|
||||
self::assertLessThan(200, mb_strlen($shortened));
|
||||
self::assertStringEndsWith('…', $shortened);
|
||||
}
|
||||
|
||||
private static function blockWithAdminLabel(string $label): Block
|
||||
{
|
||||
return Block::create('divi/text', [
|
||||
'module' => ['meta' => ['adminLabel' => ['desktop' => ['value' => $label]]]],
|
||||
]);
|
||||
}
|
||||
|
||||
public function testAttrMapFlattenGetSetRemove(): void
|
||||
{
|
||||
$attrs = [
|
||||
|
||||
Reference in New Issue
Block a user