Fix/add a stricter test for the Add Placeholder Text to a Text Field challenge (#36186)

* fix: add test for input closing tag

* fix: add condintion to final syntax test

This wil test if there's any character after the input tag that isn't a white space

* fix/tests+remove-not-needed-text
pull/40086/head
Fabricio Asfora Lira 2019-07-02 20:30:12 -03:00 committed by Manish Giri
parent 2b40551efb
commit a32f719d3a
1 changed files with 5 additions and 4 deletions

View File

@ -24,12 +24,13 @@ Set the <code>placeholder</code> value of your text <code>input</code> to "cat p
```yml
tests:
- text: Add a <code>placeholder</code> attribute to the existing text <code>input</code> element.
testString: assert($("input[placeholder]").length > 0, 'Add a <code>placeholder</code> attribute to the existing text <code>input</code> element.');
testString: assert($("input[placeholder]").length > 0);
- text: Set the value of your placeholder attribute to "cat photo URL".
testString: assert($("input") && $("input").attr("placeholder") && $("input").attr("placeholder").match(/cat\s+photo\s+URL/gi), 'Set the value of your placeholder attribute to "cat photo URL".');
testString: assert($("input") && $("input").attr("placeholder") && $("input").attr("placeholder").match(/cat\s+photo\s+URL/gi));
- text: The finished <code>input</code> element should not have a closing tag.
testString: assert(!code.match(/<input.*\/?>.*<\/input>/gi));
- text: The finished <code>input</code> element should have valid syntax.
testString: assert($("input[type=text]").length > 0 && code.match(/<input((\s+\w+(\s*=\s*(?:".*?"|'.*?'|[\^'">\s]+))?)+\s*|\s*)\/?>/gi), 'The finished <code>input</code> element should have valid syntax.');
testString: assert($("input[type=text]").length > 0);
```
</section>