3.4 KiB
3.4 KiB
id, title, challengeType, videoUrl, forumTopicId
id | title | challengeType | videoUrl | forumTopicId |
---|---|---|---|---|
bad87fee1348bd9aedf08828 | Create an Ordered List | 0 | https://scrimba.com/p/pVMPUv/cQ3B8TM | 16824 |
Description
<ol>
element, followed by any number of <li>
elements. Finally, ordered lists are closed with the </ol>
tag.
For example:
<ol>
<li>Garfield</li>
<li>Sylvester</li>
</ol>
would create a numbered list of "Garfield" and "Sylvester".
Instructions
Tests
tests:
- text: You should have an ordered list for <code>Top 3 things cats hate:</code>
testString: assert((/Top 3 things cats hate:/i).test($("ol").prev().text()));
- text: You should have an unordered list for <code>Things cats love:</code>
testString: assert((/Things cats love:/i).test($("ul").prev().text()));
- text: You should have only one <code>ul</code> element.
testString: assert.equal($("ul").length, 1);
- text: You should have only one <code>ol</code> element.
testString: assert.equal($("ol").length, 1);
- text: You should have three <code>li</code> elements within your <code>ul</code> element.
testString: assert.equal($("ul li").length, 3);
- text: You should have three <code>li</code> elements within your <code>ol</code> element.
testString: assert.equal($("ol li").length, 3);
- text: Your <code>ul</code> element should have a closing tag.
testString: assert(code.match(/<\/ul>/g) && code.match(/<\/ul>/g).length === code.match(/<ul>/g).length);
- text: Your <code>ol</code> element should have a closing tag.
testString: assert(code.match(/<\/ol>/g) && code.match(/<\/ol>/g).length === code.match(/<ol>/g).length);
- text: Your <code>li</code> element should have a closing tag.
testString: assert(code.match(/<\/li>/g) && code.match(/<li>/g) && code.match(/<\/li>/g).length === code.match(/<li>/g).length);
- text: The <code>li</code> elements in your unordered list should not be empty.
testString: $('ul li').each((i, val) => assert(__helpers.removeWhiteSpace(val.textContent)));
- text: The <code>li</code> elements in your ordered list should not be empty.
testString: $('ol li').each((i, val) => assert(!!__helpers.removeWhiteSpace(val.textContent)));
Challenge Seed
<h2>CatPhotoApp</h2>
<main>
<p>Click here to view more <a href="#">cat photos</a>.</p>
<a href="#"><img src="https://bit.ly/fcc-relaxing-cat" alt="A cute orange cat lying on its back."></a>
<p>Things cats love:</p>
<ul>
<li>cat nip</li>
<li>laser pointers</li>
<li>lasagna</li>
</ul>
<p>Top 3 things cats hate:</p>
</main>
Solution
<h2>CatPhotoApp</h2>
<main>
<p>Click here to view more <a href="#">cat photos</a>.</p>
<a href="#"><img src="https://bit.ly/fcc-relaxing-cat" alt="A cute orange cat lying on its back."></a>
<p>Things cats love:</p>
<ul>
<li>cat nip</li>
<li>laser pointers</li>
<li>lasagna</li>
</ul>
<p>Top 3 things cats hate:</p>
<ol>
<li>hate 1</li>
<li>hate 2</li>
<li>hate 3</li>
</ol>
</main>