3.2 KiB
3.2 KiB
id | title | challengeType | videoUrl | localeTitle |
---|---|---|---|---|
bad87fee1348bd9aedf08828 | Create an Ordered List | 0 | 创建有序列表 |
Description
ordered lists
或编号列表的特殊元素。有序列表以开头<ol>
元素开头,后跟任意数量的<li>
元素。最后,有序列表以</ol>
结尾例如: <OL>将创建一个编号列表“加菲猫”和“西尔维斯特”。
<LI>加菲尔德</ LI>
<LI>西尔威斯特</ LI>
</醇>
Instructions
Tests
tests:
- text: 你应该有一个“猫讨厌的三件事”的有序列表:
testString: 'assert((/Top 3 things cats hate:/i).test($("ol").prev().text()), "You should have an ordered list for "Top 3 things cats hate:"");'
- text: 你应该有一个无序的列表“猫爱的东西:”
testString: 'assert((/Things cats love:/i).test($("ul").prev().text()), "You should have an unordered list for "Things cats love:"");'
- text: 你应该只有一个<code>ul</code>元素。
testString: 'assert.equal($("ul").length, 1, "You should have only one <code>ul</code> element.");'
- text: 你应该只有一个<code>ol</code>元素。
testString: 'assert.equal($("ol").length, 1, "You should have only one <code>ol</code> element.");'
- text: 你的<code>ul</code>元素中应该有三个<code>li</code>元素。
testString: 'assert.equal($("ul li").length, 3, "You should have three <code>li</code> elements within your <code>ul</code> element.");'
- text: 你的<code>ol</code>元素中应该有三个<code>li</code>元素。
testString: 'assert.equal($("ol li").length, 3, "You should have three <code>li</code> elements within your <code>ol</code> element.");'
- text: 确保你的<code>ul</code>元素有一个结束标记。
testString: 'assert(code.match(/<\/ul>/g) && code.match(/<\/ul>/g).length === code.match(/<ul>/g).length, "Make sure your <code>ul</code> element has a closing tag.");'
- text: 确保您的<code>ol</code>元素具有结束标记。
testString: 'assert(code.match(/<\/ol>/g) && code.match(/<\/ol>/g).length === code.match(/<ol>/g).length, "Make sure your <code>ol</code> element has a closing tag.");'
- text: ''
testString: 'assert(code.match(/<\/li>/g) && code.match(/<li>/g) && code.match(/<\/li>/g).length === code.match(/<li>/g).length, "Make sure your <code>li</code> element has a closing tag.");'
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
// solution required