mirror of
https://github.com/kennethnym/jrx.git
synced 2026-03-20 20:01:19 +00:00
Support null and undefined in JrxNode type
Split JrxNode into JrxElement (concrete branded object) and JrxNode (JrxElement | null | undefined), mirroring React's ReactElement vs ReactNode pattern. Components can now return null/undefined to render nothing. - Rename isJrxNode to isJrxElement (deprecated alias kept) - Handle null-returning components in jsx/jsxs factories - Add tests for null/undefined returns, children filtering, render() rejection Co-authored-by: Ona <no-reply@ona.com>
This commit is contained in:
@@ -300,7 +300,15 @@ describe("state passthrough", () => {
|
||||
// =============================================================================
|
||||
|
||||
describe("error handling", () => {
|
||||
it("throws for non-JrxNode input", () => {
|
||||
expect(() => render({} as JrxNode)).toThrow(/expects a JrxNode/);
|
||||
it("throws for non-JrxElement input", () => {
|
||||
expect(() => render({} as JrxNode)).toThrow(/expects a JrxElement/);
|
||||
});
|
||||
|
||||
it("throws when given null", () => {
|
||||
expect(() => render(null)).toThrow(/expects a JrxElement/);
|
||||
});
|
||||
|
||||
it("throws when given undefined", () => {
|
||||
expect(() => render(undefined)).toThrow(/expects a JrxElement/);
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user