Open Hussein-miracle opened 3 hours ago
Oh, made it like that so as to support polymorphism, you can pass in as={any valid component}
it.each<[string, React.ElementType, boolean | undefined]>([
['Show.If', Show.If, true],
['Show.Else', Show.Else, undefined],
])('renders %s as a custom element', (name, Component, condition) => {
const { container } = render(
<Show as="section">
<Component
{...(condition !== undefined ? { condition } : {})}
as="span"
>
{name} content
</Component>
</Show>,
);
expect(container.firstChild?.firstChild?.nodeName).toBe('SPAN');
});
It would make the components (If and Else) work better without affecting the styling, just like v-if,v-else works.
Would probably send a PR when i have the opportunity