Resolve #3572553 Correct client props
This PR removes changes to src/Entity/JavaScriptComponent.php and the corresponding test changes to tests/src/Kernel/Config/JavascriptComponentTest.php that were added in !567 (merged)
These changes did two things:
- Normalized the props from the client. It turns out that was not necessary. I am not sure why they were put in the first place. Perhaps at some point during the MR, the client was sending values in a format where normalization was necessary. Perhaps they were never needed at all. The way that normalizePropsSchema() was written, it checks if the keys were set at a different level and then moves them. If the client sent them in a way where they are set under "items" as they should be according to the schema, then normalizePropsSchema() would do nothing.
I have stepped through 1.x normalizePropsSchema() when adding a component with a multi-value prop and confirmed normalizePropsSchema() doesn't actually do the normalization because it does not need to.
- It handles the client sending examples as
[[]]. I fixed this on the client side in this MR.
Since this MR should effectively have no UI functionality changes, we still need to test that it doesn't mess something up. So, here are the testing instructions from !567 (merged)
Testing Steps: Multi-Value Props
- Install Drupal using the standard profile and enable the
canvas_dev_modemodule:ddev drush si --account-pass admin -y && ddev drush en canvas_dev_mode -y && ddev drush cr - Open the Canvas editor.
- Create a code component with a text prop and set its cardinality to limited, then repeat with unlimited.
- Save the component, reload the page, and confirm the changes persist.
- Use the "Add to components" button to add the component to the page and verify it renders correctly.
- Repeat steps 3–5 for every prop type that supports multi-value (e.g. integer, number, image, video, link, date, enum).
Edited by Ted Bowman