-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
41aa1f1
commit 1bf0315
Showing
3 changed files
with
9 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 7 additions & 6 deletions
13
packages/integrations/react/test/parsed-react-children.test.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,21 @@ | ||
import { expect } from 'chai'; | ||
import assert from 'node:assert/strict'; | ||
import { describe, it } from 'node:test'; | ||
import convert from '../vnode-children.js'; | ||
|
||
describe('experimental react children', () => { | ||
it('has no children property for direct children', () => { | ||
const [imgVNode] = convert('<img src="abc" alt="test"></img><img src="def"></img><img src="ghi"></img>'); | ||
expect(imgVNode.props).to.not.have.property('children'); | ||
it('has undefined as children for direct children', () => { | ||
const [imgVNode] = convert('<img src="abc"></img>'); | ||
assert.deepStrictEqual(imgVNode.props.children, undefined); | ||
}); | ||
|
||
it('does not use dangerouslySetInnerHTML', () => { | ||
const [imgVNode] = convert('<img></img><img></img><img></img>'); | ||
expect(imgVNode.props).to.not.have.property('dangerouslySetInnerHTML'); | ||
assert.ok(!imgVNode.props.hasOwnProperty('dangerouslySetInnerHTML')); | ||
}); | ||
|
||
it('has no children property for nested children', () => { | ||
const [divVNode] = convert('<div><img src="xyz"></img></div>'); | ||
const [imgVNode] = divVNode.props.children; | ||
expect(imgVNode.props).to.not.have.property('children'); | ||
assert.deepStrictEqual(imgVNode.props.children, undefined); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters