2.3 KiB
2.3 KiB
id | title | localeTitle | challengeType | isRequired |
---|---|---|---|---|
5a24bbe0dba28a8d3cbd4c5e | Add Comments in JSX | Añadir comentarios en JSX | 6 | false |
Description
{/* */}
para envolver el texto del comentario.
Instructions
div
proporcionado, sin modificar los elementos h1
o p
existentes.
Tests
tests:
- text: La constante <code>JSX</code> debe devolver un elemento <code>div</code> .
testString: 'assert(JSX.type === "div", "The constant <code>JSX</code> should return a <code>div</code> element.");'
- text: El <code>div</code> debe contener una etiqueta <code>h1</code> como el primer elemento.
testString: 'assert(JSX.props.children[0].type === "h1", "The <code>div</code> should contain an <code>h1</code> tag as the first element.");'
- text: El <code>div</code> debe contener una etiqueta <code>p</code> como el segundo elemento.
testString: 'assert(JSX.props.children[1].type === "p", "The <code>div</code> should contain a <code>p</code> tag as the second element.");'
- text: El <code>JSX</code> debe incluir un comentario.
testString: 'getUserInput => assert(getUserInput("index").includes("/*") && getUserInput("index").includes("*/"), "The <code>JSX</code> should include a comment.");'
Challenge Seed
const JSX = (
<div>
<h1>This is a block of JSX</h1>
<p>Here's a subtitle</p>
</div>
);
After Test
console.info('after the test');
Solution
const JSX = (
<div>
<h1>This is a block of JSX</h1>
{ /* this is a JSX comment */ }
<p>Here's a subtitle</p>
</div>);