Document existing dependent fields functionality#85
Draft
svc-eng-cp-github wants to merge 3 commits intomasterfrom
Draft
Document existing dependent fields functionality#85svc-eng-cp-github wants to merge 3 commits intomasterfrom
svc-eng-cp-github wants to merge 3 commits intomasterfrom
Conversation
- Document and verify existing dependent fields support in SelectPlus - Add comprehensive documentation with examples in docs/dependent-fields.md - Update README with dependent fields usage section - Add working examples in demo Person resource - Create comprehensive test suite for dependent fields functionality - Verify frontend component properly handles dependent field changes - Confirm backend controller applies dependent field logic correctly The SelectPlus field already had complete support for Nova's dependent fields through the SupportsDependentFields trait and proper frontend event handling. This commit adds documentation, examples, and tests to demonstrate the functionality meets the acceptance criteria: GIVEN a SelectPlus field with dependsOn attributes and callback WHEN the dependent field is changed THEN the callback is called with Request and FormData objects Co-authored-by: openhands <openhands@all-hands.dev>
The SelectPlus package already has complete dependent fields support: - Backend: Uses SupportsDependentFields trait - Frontend: Uses DependentFormField mixin and handles dependsOn parameters - Controller: Uses applyDependsOnWithDefaultValues() for dependent field resolution This commit documents the existing functionality with: - Comprehensive documentation and usage examples - Test suite to verify the functionality works correctly - Working examples in the demo application The acceptance criteria are already met by the existing implementation. Co-authored-by: openhands <openhands@all-hands.dev>
- Rewrite dependent_field_integration_test to use actual Nova API requests - Test real workflow: dependent field changes trigger API calls to load options - Verify callbacks are executed by checking filtered results - Add test for multiple dependencies (region + state_born_in) - Add specific acceptance criteria verification test - Tests now verify the complete request/response cycle instead of manual callback execution The tests now properly demonstrate: ✅ GIVEN SelectPlus field with dependsOn attributes and callback ✅ WHEN dependent field is changed (via API request parameters) ✅ THEN callback is called with Request and FormData objects (proven by filtered results) Co-authored-by: openhands <openhands@all-hands.dev>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Overview
This PR documents the existing dependent fields functionality in SelectPlus. Upon investigation, the SelectPlus package already has complete support for Nova's dependent fields through proper implementation of the required traits and mixins.
Key Discovery ✅
The SelectPlus package already supports dependent fields through:
SelectPlus.phpusesSupportsDependentFieldstrait (lines 15, 22)FormField.vueusesDependentFormFieldmixin (line 110) and handlesdependsOnparameters (lines 163-164, 209-210)Controller.phpusesapplyDependsOnWithDefaultValues()(line 42)Acceptance Criteria ✅ (Already Met)
GIVEN a SelectPlus field with a dependsOn dependent field attributes and callback
WHEN the dependent field is changed
THEN the callback should be called with all form data in the Request and FormData objects.
Status: ✅ This functionality already works in the current codebase.
What This PR Adds
Since the functionality already exists, this PR adds:
📚 Documentation
docs/dependent-fields.md🧪 Testing
DependentFieldsTest.phpDependentFieldsIntegrationTest.php💡 Examples
Usage Example (Already Works)
Files Changed
demo/app/Nova/Person.php- Added working examplesreadme.md- Added dependent fields documentation sectiondocs/dependent-fields.md- Comprehensive usage guidedemo/tests/Feature/DependentFieldsTest.php- Unit testsdemo/tests/Feature/DependentFieldsIntegrationTest.php- Integration testsDEPENDENT_FIELDS_IMPLEMENTATION.md- Implementation summaryVerification
The tests confirm that:
dependsOn()method is available and functionalNovaRequestandFormDataobjectsConclusion
The SelectPlus package already has full dependent fields support. This PR simply documents the existing functionality and provides comprehensive examples and tests to demonstrate how to use it.
No new functionality was implemented - only documentation, examples, and tests were added to showcase the existing capabilities.