import { h } from "../src/index.js"

test("skip null and Boolean children", () => {
  expect(h("div", {}, true).children).toEqual([])
  expect(h("div", {}, false).children).toEqual([])
  expect(h("div", {}, null).children).toEqual([])
})

test("name as a function (JSX component syntax)", () => {
  const expected = h("div", { key: "key" }, ["foo", "bar"])

  const Title = props =>
    h(
      "div",
      {
        key: props.key,
        children: "foo"
      },
      props.children
    )

  expect(h(Title, { key: "key" }, "bar")).toEqual(expected)
  // <Title key="key">foo</Title>
})

@@ -302,18 +302,24 @@
 nst 
-expected =
+Title = props =%3E
  h(%22
@@ -335,167 +335,137 @@
 ey: 
-%22
+props.
 key
-%22
  %7D, 
-%5B%22foo%22, %22bar%22%5D)%0A%0A  const Title = props =%3E%0A    h(%0A      %22div%22,%0A      %7B%0A        key: props.key,%0A        children: %22foo%22%0A      %7D,%0A      props.children%0A  
+props.children)%0A%0A  expect(h(Title, %7B key: %22key%22, children: %22foo%22 %7D)).toEqual(%0A    h(%22div%22, %7B key: %22key%22 %7D, %5B%22foo%22%5D)%0A
   )%0A
@@ -491,24 +491,41 @@
 %7B key: %22key%22
+, children: %22foo%22
  %7D, %22bar%22)).
@@ -536,51 +536,50 @@
 ual(
-expected)%0A  // %3CTitle
+%0A    h(%22div%22, %7B
  key
-=
+: 
 %22key%22
-%3Efoo%3C/Title%3E
+ %7D, %5B%22bar%22%5D)%0A  )
 %0A%7D)%0A

Fix JSX props.children failing test.