Skip to content

Commit

Permalink
[ci] format
Browse files Browse the repository at this point in the history
  • Loading branch information
lilnasy authored and astrobot-houston committed Nov 21, 2023
1 parent af43fb5 commit 4aca47b
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 16 deletions.
22 changes: 11 additions & 11 deletions packages/integrations/react/test/parsed-react-children.test.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
import { expect } from 'chai';
import convert from "../vnode-children.js";
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 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 });
})
})
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 });
});
});
9 changes: 4 additions & 5 deletions packages/integrations/react/vnode-children.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,10 @@ export default function convert(children) {
let key = 0;

function createReactElementFromNode(node) {
const childVnodes = Array.isArray(node.children) && node.children.length
? node.children
.map((child) => createReactElementFromNode(child))
.filter(Boolean)
: undefined;
const childVnodes =
Array.isArray(node.children) && node.children.length
? node.children.map((child) => createReactElementFromNode(child)).filter(Boolean)
: undefined;

if (node.type === DOCUMENT_NODE) {
return createElement(Fragment, {}, childVnodes);
Expand Down

0 comments on commit 4aca47b

Please sign in to comment.