Enhance form logic property resolver and validation UI
- Refactor `shouldBeRequired()` method in FormLogicPropertyResolver for clearer logic and better handling of conditional requirements - Add comprehensive test cases for dynamic field requirement logic - Update CustomFieldValidation component with improved UI and guidance for validation setup - Improve error message and validation rule description in form validation interface
This commit is contained in:
@@ -107,4 +107,91 @@ it('can validate form logic property resolver', function ($property, $formData,
|
||||
['93ea3198-353f-440b-8dc9-2ac9a7bee124' => [], '93ea3198-353f-440b-8dc9-2ac9a7bee222' => ['abc']],
|
||||
false,
|
||||
],
|
||||
[
|
||||
[
|
||||
'id' => 'text_field',
|
||||
'name' => 'Required if checked',
|
||||
'type' => 'text',
|
||||
'hidden' => false,
|
||||
'logic' => [
|
||||
'conditions' => [
|
||||
'operatorIdentifier' => 'and',
|
||||
'children' => [
|
||||
[
|
||||
'identifier' => 'checkbox',
|
||||
'value' => [
|
||||
'operator' => 'is_checked',
|
||||
'property_meta' => [
|
||||
'id' => 'checkbox_field',
|
||||
'type' => 'checkbox'
|
||||
],
|
||||
'value' => true
|
||||
]
|
||||
]
|
||||
]
|
||||
],
|
||||
'actions' => ['require-answer']
|
||||
]
|
||||
],
|
||||
['checkbox_field' => true],
|
||||
true
|
||||
],
|
||||
[
|
||||
[
|
||||
'id' => 'text_field',
|
||||
'name' => 'Required if checked',
|
||||
'type' => 'text',
|
||||
'hidden' => false,
|
||||
'logic' => [
|
||||
'conditions' => [
|
||||
'operatorIdentifier' => 'and',
|
||||
'children' => [
|
||||
[
|
||||
'identifier' => 'checkbox',
|
||||
'value' => [
|
||||
'operator' => 'is_checked',
|
||||
'property_meta' => [
|
||||
'id' => 'checkbox_field',
|
||||
'type' => 'checkbox'
|
||||
],
|
||||
'value' => true
|
||||
]
|
||||
]
|
||||
]
|
||||
],
|
||||
'actions' => ['require-answer']
|
||||
]
|
||||
],
|
||||
['checkbox_field' => false],
|
||||
false
|
||||
],
|
||||
[
|
||||
[
|
||||
'id' => 'text_field',
|
||||
'name' => 'Required if checked',
|
||||
'type' => 'text',
|
||||
'hidden' => false,
|
||||
'logic' => [
|
||||
'conditions' => [
|
||||
'operatorIdentifier' => 'and',
|
||||
'children' => [
|
||||
[
|
||||
'identifier' => 'checkbox',
|
||||
'value' => [
|
||||
'operator' => 'is_checked',
|
||||
'property_meta' => [
|
||||
'id' => 'checkbox_field',
|
||||
'type' => 'checkbox'
|
||||
],
|
||||
'value' => true
|
||||
]
|
||||
]
|
||||
]
|
||||
],
|
||||
'actions' => ['require-answer']
|
||||
]
|
||||
],
|
||||
['checkbox_field' => null],
|
||||
false
|
||||
]
|
||||
]);
|
||||
|
||||
Reference in New Issue
Block a user