feat: explain the type collision on contact fields (trial)
A contact-field item whose type is no allowed child now gets a hint that type is the node type, with the attrs path (fieldItem.advanced.type) and the lit-divi-update set alternative, instead of "unbekanntes Modul divi/email". The metadata fixture gains contact-form/contact-field (regenerated from Divi 5.2.1, additions only). 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:
@@ -530,4 +530,26 @@ final class ComposerTest extends TestCase
|
||||
|
||||
self::assertStringContainsString('2 Spalten, aber 3 Modul-Listen', $result['errors']['nodes[0].rows[0].modules']);
|
||||
}
|
||||
|
||||
/**
|
||||
* Trial feedback: `type` on a contact field is the node type, not the field type. A value that
|
||||
* is no allowed child gets a dedicated hint instead of "unbekanntes Modul divi/email".
|
||||
*/
|
||||
public function testTypeOnAnItemWithATypeFieldExplainsTheCollision(): void
|
||||
{
|
||||
$result = ComposeFixture::composer()->compose([['type' => 'section', 'modules' => [
|
||||
['type' => 'contact-form', 'items' => [
|
||||
['title' => 'Name'],
|
||||
['type' => 'email', 'title' => 'E-Mail'],
|
||||
['type' => 'contact-field', 'title' => 'Nachricht'],
|
||||
]],
|
||||
]]], null, 'nodes');
|
||||
|
||||
$message = $result['errors']['nodes[0].modules[0].modules[0][0].items[1].type'] ?? '';
|
||||
self::assertStringContainsString('`type` ist hier der Knotentyp', $message);
|
||||
self::assertStringContainsString('fieldItem.advanced.type', $message);
|
||||
self::assertStringContainsString('"email"', $message);
|
||||
self::assertStringNotContainsString('unbekanntes Modul', $message);
|
||||
self::assertCount(1, $result['errors'], 'the explicit contact-field type is fine');
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user