Commit b355eb9
committed
bug #221 [LiveComponent] Fix expanded choices and checkboxes in forms (Lustmored)
This PR was squashed before being merged into the 2.x branch.
Discussion
----------
[LiveComponent] Fix expanded choices and checkboxes in forms
| Q | A
| ------------- | ---
| Bug fix? | yes
| New feature? | no
| Tickets |
| License | MIT
When using live component with forms that contains expanded choices list (rendered as a list of radio buttons) extracting form values returns array of nulls (one per choice), while frontend expects single value.
Therefore after calling first `update` and then trying to call update on expanded field controller throws (`The property used in data-model="${propertyPath}" was never initialized. Did you forget to add exposed={"${lastPart}"} to its LiveProp?`).
This simple change fixes the issue. I have also added simple test case for a few basic form types.
Commits
-------
7605821 Code Style
2de0cbf Rebuild dist file
d96d82f Adapt to changes in component
2f735a2 Simplify form functional test
eb92ebd Use $initialData instead of 'data' in FormType to make tests easier to follow
33dabc0 fetchMock.done() is not needed anymore
857ff1f Return early and throw on unsupported element
bd05418 Renames and comments
f7dbdc1 Add description to updateArrayDataFromChangedElement
d195ee9 Rename getArrayValue
914bcd5 Spacing issues
f13a498 Merge branch '2.x' into fix-expanded-choices
a636a71 Add simple select multiple test to functional test
4c8336b Add select multiple to backend form test
d00cb41 Rebuild dist/
3204490 getArrayValues should return empty array instead of null to mimic backend behavior
f87796d Rebuild `dist/`
56caf14 Fix last tests
e51f202 Add tests for checkbox and select multiple cases
f342a7a Introduce getArrayValue with unit tests
7580a73 Add test for normalizeModelName and explain change within
a194f0c After merge cleanup and tests fixing
18741bd Merge branch '2.x' into fix-expanded-choices
a5f56f2 Other attempt at tests
ffd6b72 Code style
296f9a4 misstype
6d41d90 Try to make JS tests work
1e31c30 Move array handling into _updateModelFromElement
d183645 Add backend web test case for checkboxes
66f85e8 Rework FormComponent1 to use form type and register it in test kernel.
546c5a7 Don't pass values to extractFormValues
71f49ae Rebuild dist assets
0f4e70e Merge branch '2.x' into fix-expanded-choices
a17870f Resolve conflicts
2f1d0ee Handle collections of checkboxes as data arrays
255d9f9 Add choice_multiple to test and fix uninitialized value
cfbbf9d Set data to null on unchecked elements (checkboxes)
f5e34fa Always propagate form null values to formValues
cab4c4a Rename test component to avoid possible conflicts
841e07f Simplify if clause and fix assert arguments order
fc953dd Code style
4a37d10 Fix form values for ChoiceType with expanded: true
76de2a2 Add basic test for formValues()
e76bdb9 Add symfony/form to dev dependenciesFile tree
14 files changed
+713
-23
lines changed- src/LiveComponent
- assets
- dist
- src
- test
- controller
- src
- tests
- Fixtures
- Component
- Form
- templates/components
- Functional/Form
- Unit/Form
14 files changed
+713
-23
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
898 | 898 | | |
899 | 899 | | |
900 | 900 | | |
901 | | - | |
| 901 | + | |
902 | 902 | | |
903 | 903 | | |
904 | 904 | | |
905 | 905 | | |
906 | 906 | | |
907 | 907 | | |
908 | 908 | | |
| 909 | + | |
| 910 | + | |
| 911 | + | |
| 912 | + | |
| 913 | + | |
| 914 | + | |
| 915 | + | |
| 916 | + | |
| 917 | + | |
909 | 918 | | |
910 | 919 | | |
911 | 920 | | |
| |||
928 | 937 | | |
929 | 938 | | |
930 | 939 | | |
| 940 | + | |
931 | 941 | | |
932 | 942 | | |
933 | 943 | | |
934 | | - | |
| 944 | + | |
| 945 | + | |
935 | 946 | | |
936 | 947 | | |
937 | 948 | | |
| |||
979 | 990 | | |
980 | 991 | | |
981 | 992 | | |
| 993 | + | |
| 994 | + | |
| 995 | + | |
| 996 | + | |
| 997 | + | |
| 998 | + | |
| 999 | + | |
| 1000 | + | |
| 1001 | + | |
| 1002 | + | |
| 1003 | + | |
| 1004 | + | |
| 1005 | + | |
| 1006 | + | |
| 1007 | + | |
| 1008 | + | |
| 1009 | + | |
| 1010 | + | |
| 1011 | + | |
| 1012 | + | |
| 1013 | + | |
| 1014 | + | |
| 1015 | + | |
| 1016 | + | |
982 | 1017 | | |
983 | 1018 | | |
984 | 1019 | | |
| |||
1022 | 1057 | | |
1023 | 1058 | | |
1024 | 1059 | | |
1025 | | - | |
1026 | | - | |
| 1060 | + | |
1027 | 1061 | | |
1028 | 1062 | | |
1029 | | - | |
1030 | | - | |
| 1063 | + | |
1031 | 1064 | | |
1032 | 1065 | | |
1033 | 1066 | | |
| |||
1088 | 1121 | | |
1089 | 1122 | | |
1090 | 1123 | | |
1091 | | - | |
| 1124 | + | |
| 1125 | + | |
| 1126 | + | |
| 1127 | + | |
| 1128 | + | |
| 1129 | + | |
| 1130 | + | |
| 1131 | + | |
| 1132 | + | |
| 1133 | + | |
| 1134 | + | |
1092 | 1135 | | |
1093 | 1136 | | |
1094 | 1137 | | |
| |||
1112 | 1155 | | |
1113 | 1156 | | |
1114 | 1157 | | |
1115 | | - | |
| 1158 | + | |
1116 | 1159 | | |
1117 | 1160 | | |
1118 | 1161 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
5 | | - | |
| 5 | + | |
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
| 9 | + | |
9 | 10 | | |
10 | 11 | | |
11 | 12 | | |
| |||
105 | 106 | | |
106 | 107 | | |
107 | 108 | | |
108 | | - | |
109 | | - | |
110 | | - | |
| 109 | + | |
111 | 110 | | |
112 | 111 | | |
113 | 112 | | |
114 | | - | |
115 | | - | |
116 | | - | |
| 113 | + | |
117 | 114 | | |
118 | 115 | | |
119 | 116 | | |
| |||
194 | 191 | | |
195 | 192 | | |
196 | 193 | | |
197 | | - | |
| 194 | + | |
198 | 195 | | |
199 | 196 | | |
200 | 197 | | |
201 | | - | |
202 | 198 | | |
203 | 199 | | |
204 | 200 | | |
| |||
207 | 203 | | |
208 | 204 | | |
209 | 205 | | |
210 | | - | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
211 | 225 | | |
212 | 226 | | |
213 | 227 | | |
| |||
257 | 271 | | |
258 | 272 | | |
259 | 273 | | |
260 | | - | |
| 274 | + | |
261 | 275 | | |
262 | 276 | | |
263 | 277 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | | - | |
3 | | - | |
| 2 | + | |
4 | 3 | | |
5 | 4 | | |
6 | 5 | | |
| |||
14 | 13 | | |
15 | 14 | | |
16 | 15 | | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
17 | 28 | | |
18 | 29 | | |
19 | 30 | | |
| |||
64 | 75 | | |
65 | 76 | | |
66 | 77 | | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
67 | 82 | | |
68 | 83 | | |
69 | 84 | | |
70 | 85 | | |
71 | | - | |
| 86 | + | |
| 87 | + | |
72 | 88 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
0 commit comments