import { Fragment, RawHtml, jsx, jsxs, raw } from './jsx-runtime' describe('jsx-runtime', () => { describe('element rendering', () => { it('should render an element with attributes and children when written as JSX', () => { // Arrange & Act const element =
Hello
// Assert expect(String(element)).toBe('
Hello
') }) it('should render nested elements without double-escaping when elements contain elements', () => { // Arrange & Act const element = (

Title

Body

) // Assert expect(String(element)).toBe('

Title

Body

') }) it('should render a void element without a closing tag when the tag is void', () => { // Arrange & Act const element = // Assert expect(String(element)).toBe('') }) it('should render a function component when the tag is capitalised', () => { // Arrange const Badge = (props: { text: string }) => {props.text} // Act const element = // Assert expect(String(element)).toBe('New') }) it('should render fragment children without a wrapper when using fragment syntax', () => { // Arrange & Act const element = ( <>
Name
Value
) // Assert expect(String(element)).toBe('
Name
Value
') }) }) describe('escaping', () => { it('should escape HTML entities in text children when the child is a string', () => { // Arrange const userInput = '' // Act const element =

{userInput}

// Assert expect(String(element)).toBe('

<script>alert("xss")</script>

') }) it('should escape attribute values when the value could break out of its quotes', () => { // Arrange const attackValue = '" onload="alert(1)' // Act const element =
// Assert expect(String(element)).toBe('
') }) it('should escape attribute names when attributes are spread from untrusted records', () => { // Arrange const attributes: Record = { '">