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>
})

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 Title = props => h("div", { key: props.key }, props.children)

  expect(h(Title, { key: "key", children: "foo" })).toEqual(
    h("div", { key: "key" }, ["foo"])
  )

  expect(h(Title, { key: "key", children: "foo" }, "bar")).toEqual(
    h("div", { key: "key" }, ["bar"])
  )
})

Fix JSX props.children failing test.