Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions ppx/ppx.ml
Original file line number Diff line number Diff line change
Expand Up @@ -289,6 +289,9 @@ let rewrite_jsx =
| Pexp_ident id ->
rewrite_component ~loc:tag.pexp_loc id rest_of_args children
| _ -> assert false)
| Pexp_apply ({ pexp_desc = Pexp_send _; _ }, _)
when has_jsx_attr expr.pexp_attributes ->
super#expression expr
(* div() [@JSX] *)
| Pexp_apply (_tag, _props) when has_jsx_attr expr.pexp_attributes ->
raise_errorf ~loc:expr.pexp_loc "tag should be an identifier"
Expand Down
15 changes: 15 additions & 0 deletions test/Test_without_transformation.ml
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,20 @@ let render_svg =
L 5 3 z M 14 3 L 14 5 L 17.585938 5 L 8.2929688 14.292969 L 9.7070312 \
15.707031 L 19 6.4140625 L 19 10 L 21 10 L 21 3 L 14 3 z\"></path></svg>"

let obj =
object
method make () ~children = JSX.node "div" [] [ JSX.string children ]
end

(* The point of this test is to verify that --
* assuming our jsx provider has properly output the object component
* we can process it -- this avoids having to add any mlx files to our test
* or having to extend ReasonML *)
let object_children =
test "object_children" @@ fun () ->
let str = (obj#make () ~children:"test" [@JSX]) in
assert_string (JSX.render str) "<div>test</div>"

Comment on lines +198 to +211
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This test doesn't reflect much from the change on the ppx. I mean, the current test case is valid without it.

let tests =
( "render",
[
Expand All @@ -218,4 +232,5 @@ let tests =
render_with_doc_type;
render_svg;
jsx_unsafe;
object_children;
] )