File tree Expand file tree Collapse file tree 3 files changed +20
-0
lines changed Expand file tree Collapse file tree 3 files changed +20
-0
lines changed Original file line number Diff line number Diff line change @@ -1154,6 +1154,19 @@ and print_jsx cxt ?(spread_props : J.expression option)
11541154 in
11551155
11561156 let print_prop n x ctx =
1157+ let n =
1158+ (* turn aria-label to ariaLabel *)
1159+ if not (String. contains n '-' ) then n
1160+ else
1161+ let chars = String. to_seq n |> List. of_seq in
1162+ let rec visit chars acc =
1163+ match chars with
1164+ | [] -> List. rev acc
1165+ | '-' :: l :: rest -> visit rest (Char. uppercase_ascii l :: acc)
1166+ | c :: rest -> visit rest (c :: acc)
1167+ in
1168+ visit chars [] |> List. to_seq |> String. of_seq
1169+ in
11571170 let prop_name = Js_dump_property. property_key_string n in
11581171 P. string f prop_name;
11591172 P. string f " =" ;
Original file line number Diff line number Diff line change @@ -203,6 +203,10 @@ let _optional_props = <Jsx_preserve_test$ComponentWithOptionalProps
203203 element = { < div /> }
204204/> ;
205205
206+ let _props_with_hypen = < label
207+ ariaLabel = "close sidebar"
208+ /> ;
209+
206210export {
207211 Icon ,
208212 _single_element_child ,
@@ -228,5 +232,6 @@ export {
228232 _large_component ,
229233 ComponentWithOptionalProps ,
230234 _optional_props ,
235+ _props_with_hypen ,
231236}
232237/* _single_element_child Not a pure module */
Original file line number Diff line number Diff line change @@ -126,3 +126,5 @@ module ComponentWithOptionalProps = {
126126}
127127
128128let _optional_props = <ComponentWithOptionalProps i = 1 s = "test" element = {<div />} />
129+
130+ let _props_with_hypen = <label ariaLabel = {"close sidebar" } />
You can’t perform that action at this time.
0 commit comments