2024-01-31 03:29:26 -05:00
|
|
|
import assert from 'node:assert/strict';
|
|
|
|
import { describe, it } from 'node:test';
|
2023-11-21 12:21:41 -05:00
|
|
|
import convert from '../vnode-children.js';
|
2023-11-21 12:19:43 -05:00
|
|
|
|
|
|
|
describe('experimental react children', () => {
|
2023-11-21 12:21:41 -05:00
|
|
|
it('has undefined as children for direct children', () => {
|
|
|
|
const [imgVNode] = convert('<img src="abc"></img>');
|
2024-02-16 06:41:16 -05:00
|
|
|
assert.deepEqual(imgVNode.props.children, undefined);
|
2023-11-21 12:21:41 -05:00
|
|
|
});
|
2023-11-21 12:19:43 -05:00
|
|
|
|
2023-11-21 12:21:41 -05:00
|
|
|
it('has undefined as children for nested children', () => {
|
|
|
|
const [divVNode] = convert('<div><img src="xyz"></img></div>');
|
|
|
|
const [imgVNode] = divVNode.props.children;
|
2024-02-16 06:41:16 -05:00
|
|
|
assert.deepEqual(imgVNode.props.children, undefined);
|
2023-11-21 12:21:41 -05:00
|
|
|
});
|
|
|
|
});
|