-
Notifications
You must be signed in to change notification settings - Fork 467
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(edit-content): issues 1-1 relationship (#31097)
### Parent issue #31040 ### Proposed Changes This pull request includes changes to improve the handling of relationship fields in the `RelationshipFieldStore` and related utilities. The changes focus on enhancing the formatting of relationship identifiers, improving edge case handling, and refining utility functions for extracting relationships from contentlets. Improvements to `RelationshipFieldStore`: * [`core-web/libs/edit-content/src/lib/fields/dot-edit-content-relationship-field/store/relationship-field.store.spec.ts`](diffhunk://#diff-d2a9a6233c2b1ba38c683725d2e68092978e7023e9269dbabab2fcdfa47224e2R14-R24): Added identifiers to mock data and updated tests to validate the correct formatting of relationship identifiers. Added new tests to handle various edge cases, including pagination, data manipulation, and initialization with extreme cardinality values. [[1]](diffhunk://#diff-d2a9a6233c2b1ba38c683725d2e68092978e7023e9269dbabab2fcdfa47224e2R14-R24) [[2]](diffhunk://#diff-d2a9a6233c2b1ba38c683725d2e68092978e7023e9269dbabab2fcdfa47224e2L177-R275) * [`core-web/libs/edit-content/src/lib/fields/dot-edit-content-relationship-field/store/relationship-field.store.ts`](diffhunk://#diff-a2c980da63c75c9dc2cd899475beab89cb79492b1dc0819574fc380e856e7ed1L66-R66): Modified the `formattedRelationship` method to use identifiers instead of IDs. Enhancements to utility functions: * [`core-web/libs/edit-content/src/lib/fields/dot-edit-content-relationship-field/utils/index.spec.ts`](diffhunk://#diff-d895ed8b296eedf36d10492abea40febbb6bf54779bd4fc52d1d1c52256de1bfL8): Removed the `mockContentlet` and replaced it with inline creation of fake contentlets. Added tests for handling single relationships, null/undefined variables, and non-array relationships. [[1]](diffhunk://#diff-d895ed8b296eedf36d10492abea40febbb6bf54779bd4fc52d1d1c52256de1bfL8) [[2]](diffhunk://#diff-d895ed8b296eedf36d10492abea40febbb6bf54779bd4fc52d1d1c52256de1bfL48-R47) [[3]](diffhunk://#diff-d895ed8b296eedf36d10492abea40febbb6bf54779bd4fc52d1d1c52256de1bfL57-R56) [[4]](diffhunk://#diff-d895ed8b296eedf36d10492abea40febbb6bf54779bd4fc52d1d1c52256de1bfR67-R109) [[5]](diffhunk://#diff-d895ed8b296eedf36d10492abea40febbb6bf54779bd4fc52d1d1c52256de1bfL83-R122) * [`core-web/libs/edit-content/src/lib/fields/dot-edit-content-relationship-field/utils/index.ts`](diffhunk://#diff-02d1a23439f098900847a8ea3ad106b1eb8d5afe92e08186d7c9b0c82a13e5eaL23-R32): Updated the `getRelationshipFromContentlet` function to handle various edge cases and added detailed documentation for the function parameters and return values. [[1]](diffhunk://#diff-02d1a23439f098900847a8ea3ad106b1eb8d5afe92e08186d7c9b0c82a13e5eaL23-R32) [[2]](diffhunk://#diff-02d1a23439f098900847a8ea3ad106b1eb8d5afe92e08186d7c9b0c82a13e5eaL35-R52) ### Checklist - [x] Tests - [x] Translations - [x] Security Implications Contemplated (add notes if applicable)
- Loading branch information
Showing
4 changed files
with
156 additions
and
14 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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