fixed testString to disallow any extra characters from passing. Also … (#35987)

* fixed testString to disallow any extra characters from passing. Also changed markup in testString and text

* Update curriculum/challenges/english/01-responsive-web-design/applied-accessibility/standardize-times-with-the-html5-datetime-attribute.english.md

Co-Authored-By: Stevo99 <Sfailla1983@gmail.com>

* fixed test so it won't pass if datetime attr is left blank

* fixed test so it will not pass if datetime attribute is left empty

* fixed error in testString where test would pass if user runs test right away

* added tear-down div to make test code look cleaner

* fixed merge conflict. added tear-down div to make code look cleaner

* fixed testString to disallow any extra characters from passing. Also changed markup in testString and text

* Update curriculum/challenges/english/01-responsive-web-design/applied-accessibility/standardize-times-with-the-html5-datetime-attribute.english.md

improvement to test case where element should have closing tag.

Co-Authored-By: Oliver Eyton-Williams <ojeytonwilliams@gmail.com>

* fixed conflict in git

* Update curriculum/challenges/english/01-responsive-web-design/applied-accessibility/standardize-times-with-the-html5-datetime-attribute.english.md

removed unnecessary test

Co-Authored-By: Randell Dawson <5313213+RandellDawson@users.noreply.github.com>

* Update curriculum/challenges/english/01-responsive-web-design/applied-accessibility/standardize-times-with-the-html5-datetime-attribute.english.md

removed unnecessary test

Co-Authored-By: Randell Dawson <5313213+RandellDawson@users.noreply.github.com>
This commit is contained in:
Steven Failla
2019-06-28 18:49:00 -04:00
committed by Manish Giri
parent 50b45b9379
commit 438e7d4c51

View File

@@ -22,15 +22,14 @@ Camper Cat's Mortal Kombat survey results are in! Wrap a <code>time</code> tag a
```yml
tests:
- text: Your <code>time</code> tags should wrap around the text "Thursday, September 15&lt;sup&gt;th&lt;/sup&gt;".
testString: assert($('time').text().match(/Thursday, September 15th/g), 'Your <code>time</code> tags should wrap around the text "Thursday, September 15&lt;sup&gt;th&lt;/sup&gt;".');
- text: Your <code>time</code> tag should have a <code>datetime</code> attribute that is not empty.
testString: assert($('time').attr('datetime'), 'Your <code>time</code> tag should have a <code>datetime</code> attribute that is not empty.');
- text: Your <code>datetime</code> attribute should be set to a value of 2016-09-15.
testString: assert($('time').attr('datetime') === "2016-09-15", 'Your <code>datetime</code> attribute should be set to a value of 2016-09-15.');
- text: Make sure your <code>time</code> element has a closing tag.
testString: assert(code.match(/<\/time>/g) && code.match(/<\/time>/g).length === 4, 'Make sure your <code>time</code> element has a closing tag.');
- text: Your code should have a <code>p</code> element which includes the text "Thank you to everyone for responding to Master Camper Cat's survey." and include a <code>time</code> element.
testString: assert(timeElement.length);
- text: Your added <code>time</code> tags should wrap around the text "Thursday, September 15&lt;sup&gt;th&lt;/sup&gt;".
testString: assert(timeElement.length && $(timeElement).html().trim() === "Thursday, September 15<sup>th</sup>");
- text: Your added <code>time</code> tag should have a <code>datetime</code> attribute that is not empty.
testString: assert(datetimeAttr && datetimeAttr.length);
- text: Your added <code>datetime</code> attribute should be set to a value of 2016-09-15.
testString: assert(datetimeAttr === "2016-09-15");
```
</section>
@@ -76,7 +75,18 @@ tests:
</div>
<div id='html-teardown'>
```html
<script>
const pElement = $("article > p")
.filter((_, elem) => $(elem).text().includes("Thank you to everyone for responding to Master Camper Cat's survey."));
const timeElement = pElement[0] ? $(pElement[0]).find("time") : null;
const datetimeAttr = $(timeElement).attr("datetime");
</script>
```
</div>
</section>