summaryrefslogtreecommitdiff
path: root/packages/integrations/react/test/parsed-react-children.test.js
diff options
context:
space:
mode:
authorGravatar Arsh <69170106+lilnasy@users.noreply.github.com> 2023-11-21 17:19:43 +0000
committerGravatar GitHub <noreply@github.com> 2023-11-21 22:49:43 +0530
commitaf43fb51726fa2242cec03cb019fa4fa4a4403ef (patch)
tree2585b5ede16fd498e51fa81ef3e86ff7024ae896 /packages/integrations/react/test/parsed-react-children.test.js
parentd9e72cea399c1426311faa2ac93ce66c89b5e7ac (diff)
downloadastro-af43fb51726fa2242cec03cb019fa4fa4a4403ef.tar.gz
astro-af43fb51726fa2242cec03cb019fa4fa4a4403ef.tar.zst
astro-af43fb51726fa2242cec03cb019fa4fa4a4403ef.zip
fix(react): make children `undefined` with `experimentalReactChildren` (#9141)
* add test script * make children `undefined` with self-closing tags * add changeset * refactor: simplify
Diffstat (limited to 'packages/integrations/react/test/parsed-react-children.test.js')
-rw-r--r--packages/integrations/react/test/parsed-react-children.test.js15
1 files changed, 15 insertions, 0 deletions
diff --git a/packages/integrations/react/test/parsed-react-children.test.js b/packages/integrations/react/test/parsed-react-children.test.js
new file mode 100644
index 000000000..876897c95
--- /dev/null
+++ b/packages/integrations/react/test/parsed-react-children.test.js
@@ -0,0 +1,15 @@
+import { expect } from 'chai';
+import convert from "../vnode-children.js";
+
+describe('experimental react children', () => {
+ it('has undefined as children for direct children', () => {
+ const [ imgVNode ] = convert('<img src="abc"></img>');
+ expect(imgVNode.props).to.deep.include({ children: undefined });
+ })
+
+ it('has undefined as children for nested children', () => {
+ const [ divVNode ] = convert('<div><img src="xyz"></img></div>');
+ const [ imgVNode ] = divVNode.props.children;
+ expect(imgVNode.props).to.deep.include({ children: undefined });
+ })
+})